我正在尝试创建一个新的 Activity,但出现以下错误(图片底部)
InvalidReferenceException: Error executing FreeMarker template...
如果我通过创建一个扩展 Activity 类的 Java 类来手动创建一个 Activity,那么它就可以工作。
最佳答案
来自以下链接:Cannot create empty activity, in Android Studio 2.2.3 ,有些人有同样的问题:
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]
问题与在C 驱动器上创建的tmp 文件夹有关
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.
删除C:\tmp文件夹解决了问题
I was having the same issue...deleting tmp folder helped.
有关根本原因的更多信息:
I realized this issue is because of the "buildDir" path in build.gradle file in Udacity projects. See screen shot.
关于java - 创建新 Activity 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42946819/