I am trying to create a new Activity, but the following error comes up (bottom of image)
InvalidReferenceException: Error executing FreeMarker templa
1) Comment out the following code in gradle file (build.gradle)
buildDir = "C:/tmp/${rootProject.name}/${project.name}" ---comment this line
2) Use Sync Now at the top of the page to sync the project 3) Add the new Empty Activity (Child Activity) 4) Uncomment the lines you commented out in the gradle file 5) Sync the project again
From the following link : Cannot create empty activity, in Android Studio 2.2.3 , some people had the same kind of problem :
ERROR - llij.ide.plugins.PluginManager - com.android.tools.idea.templates.FreemarkerUtils$TemplateProcessingException: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> manifestDir [in template "root://activities/common/common_globals.xml.ftl" at line 26, column 39]
The problem was related to a tmp folder created on the C drive
When I first installed Android SDK, I installed it to the C drive and did some exercises inside ud851-Exercises-student there. Then, because I ran out of space on the C drive, I uninstalled it from C and installed it to D. Maybe I accidentally opened one of those projects and that cause the Android Studio to create the tmp folder in C.
Deleting the C:\tmp folder solved the problem
I was having the same issue...deleting tmp folder helped.
Some more information about the root cause :
I realized this issue is because of the "buildDir" path in build.gradle file in Udacity projects. See screen shot.