错误详情:
Android Studio 2.1.1
5:09:32 PM InvalidReferenceException: Error executing FreeMarker template: The following has evaluated to null or missing:
==> srcDir [in template "root://other/BlankFragment/globals.xml.ftl" at line 7, column 34]
Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use when-presentwhen-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??
The failing instruction:
==> ${srcDir} [in template "root://other/BlankFragment/globals.xml.ftl" at line 7, column 32] (show balloon)
***When Show balloon is clicked***
InvalidReferenceException
Error executing FreeMarker template: The following has evaluated to null or missing: ==> srcDir [in template "root://other/BlankFragment/globals.xml.ftl" at line 7, column 34] Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use #if myOptionalVar??>when-present#else>when-missing#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)?? The failing instruction: ==> ${srcDir} [in template "root://other/BlankFragment/globals.xml.ftl" at line 7, column 32]
答案 0 :(得分:2)
如果您在Udacity项目中遇到此问题,这是一个知道错误:
https://github.com/udacity/ud851-Exercises/issues/67
建议的解决方法是:
从项目build.gradle中删除以下配置,然后单击立即同步
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
}
然后关闭项目>再次导入项目。