2013-12-20 17 views
11

我想在Android SDK中推出的PhoneGap Android應用程序,但我收到一個錯誤:PhoneGap的錯誤Android SDK中的build.xml:950:空返回:1

[phonegap] detecting Android SDK environment... 
[phonegap] using the local environment 
[phonegap] compiling Android... 
    [error] An error occurred while building the android project.Error executing "ant debug -f "/Users/me/Projects/one/platforms/android/build.xml"": 
BUILD FAILED 
/Applications/Android/adt-bundle-mac-x86_64-20131030/sdk/tools/ant/build.xml:932: The following error occurred while executing this line: 
/Applications/Android/adt-bundle-mac-x86_64-20131030/sdk/tools/ant/build.xml:950: null returned: 1 

我按照本指南http://docs.phonegap.com/en/2.2.0/guide_getting-started_android_index.md.html但它不工作。

這是什麼原因造成的?

回答

11

你最有可能也越來越線

invalid resource directory name: /YOUR/PROJECT/ROOT/PATH/bin/res/crunch

錯誤代碼前右,所以打開終端並輸入以下內容:

cd YOUR/PROJECT/ROOT/PATH 

rm -fR $(find . -type d -name crunch|xargs) 
+0

我在macosx上錯誤仍然存​​在:( – sbaaaang

+0

950行是ignoreAssets =「$ {aapt.ignore.assets}」你確定你已經爲Cordova正確配置了資產嗎?查看https:// github .com/dev-mobile/cordova-starter/blob/master/android_cordova_starter/build.xml – LoungeKatt

+0

很好的解決方案! – confile

1

有同樣的問題。東西,可以幫助是閱讀antlog作爲推薦here

這樣做時才運行ant -logfile //antLogFile.txt release -f ./AppMain/build.xml 或文件夾本身英寸即:platforms\android運行ant -logfile ./antLogFile.txt release

我的問題是文件與Hebrew字符其名稱..

0

如果你有一個以上的項目,您使用的是同樣的資產如:圖像,螞蟻將無法建立。您可以使用ant clean從其他項目中刪除緩存,並避免此問題中提出的問題crunch/resource packaging with aapt in ant build uses cache from other projects

不過,在我的情況下,但以不同的字母大小寫。 Ant的構建過程不區分大小寫,因此這些圖像被複制,是錯誤原因。

我特別修復的是重命名或刪除其中的一個圖像,以允許cordova構建我的項目。

4

我只是不得不cd到平臺/ android dir並運行ant clean,它爲我解決了這個問題。

1

嗨對不起,答案後期

的替代其他的解決方案可能是OS-X具體的,但我是有這個解決方案同樣的問題,並沒有爲我工作的資產,不過提到讓我回去和沖刷在我的建立日誌,我注意到這一點:

[aapt] /Users/rowdoggnz/Development/cordova/surveyapp/platforms/android/assets/www/lib/fa/Icon [aapt] : error: Invalid filename. Unable to add.

這是我的錯誤的原因,它與原始海報共享相同的錯誤代碼和行參考。

由於某些原因,OS-X似乎因爲隱藏而在查找器中不可見,我使用名爲「Invisiblix」的應用程序查看我的項目文件夾並刪除了所有的「圖標」文件,我的應用程序會生成很好。

我猜iOS構建自然會忽略這些圖標文件,但Ant不。

希望這可以幫助別人。

+0

我運行'cd platforms/android',然後'ant clean',然後如你所建議的,我使用InvisibiliX(我已經使用了各種原因)找到並刪除所有「圖標「文件,就是這樣! –

0

我在使用Ionic框架的OSX中遇到了這個問題。這是我的解決辦法:

我跑這個項目根目錄下的命令行:

find . -name Icon -exec rm {} \; 

上面並下降通過什麼整個項目來搜索文件名圖標。發現它們後,它們被刪除。

之後我跑了我的構建過程,一切都很好。

0

確保您已經正確安裝了先決條件。

相關問題