2016-08-04 36 views
2

詳情:Android Studio中的錯誤,而試圖添加一個片段來推算誤差

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

您需要提供有關導致錯誤的更多信息。看看這個答案 - 類似的問題http://stackoverflow.com/questions/35805983/freemarker-template-error-the-following-has-evaluated-to-null-or-missing-but – Zain

+0

謝謝,一對夫婦「無效緩存/重啓」例程 - 此錯誤消失。 –

回答

2

如果你面對一個Udacity項目這個問題,這是一個知道是不是BUG:

https://github.com/udacity/ud851-Exercises/issues/67

也有類似問題報告 herehere

提出的解決方法是:

從項目的build.gradle刪除以下配置,然後點擊同步現在

String osName = System.getProperty("os.name").toLowerCase(); 
if (osName.contains("windows")) { 
    buildDir = "C:/tmp/${rootProject.name}/${project.name}" 
} 

然後再次關閉項目>導入項目。

+0

我現在收到此錯誤:錯誤:無法收縮文件H:\ Dropbox \ workspace_AndroidStudio \ _Udacity_2_ToyApp \ Lesson06-Visualizer-Preferences \ T06.01-Exercise-SetupTheActivity \ app \ build \ intermediates \ exploded-aar \ com.android .support \ appcompat-v7 \ 25.1.0 \ res \ drawable-hdpi-v4 \ abc_textfield_search_default_mtrl_alpha.9.png到H:\ Dropbox \ workspace_AndroidStudio \ _Udacity_2_ToyApp \ Lesson06-Visualizer-Preferences \ T06.01-Exercise-SetupTheActivity \ app \建立\中間體\水庫\合併\調試\繪製-HDPI-V4 \ abc_textfield_search_default_mtrl_alpha.9.png –

相關問題