我想用Ant構建我的Android項目。每當我使用Eclipse進行構建時,應用程序都會編譯成功。然後,我可以運行ant installd
並將該應用程序的調試版本安裝到我的設備上。但是,如果我運行ant clean
,然後運行ant debug
生成失敗,因爲它無法找到類OverlayItem。但在project.properties我有target=Google Inc.:Google APIs:4
。我究竟做錯了什麼?使用Google API時Ant無法生成
控制檯輸出
cas-v1500-sh:VIIAD Ant VIIAD$ ant debug
Buildfile: /Users/VIIAD/Desktop/VIIAD/VIIAD Ant/build.xml
-set-mode-check:
-set-debug-files:
-set-debug-mode:
-debug-obfuscation-check:
-setup:
[echo] Gathering info for VIIAD Ant...
[setup] Android SDK Tools Revision 16
[setup] Project Target: Google APIs
[setup] Vendor: Google Inc.
[setup] Platform Version: 1.6
[setup] API level: 4
[setup]
[setup] ------------------
[setup] Resolving library dependencies:
[setup] No library dependencies.
[setup]
[setup] ------------------
[setup]
-build-setup:
[echo] Creating output directories if needed...
-pre-build:
-code-gen:
[echo] ----------
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
[echo] ----------
[echo] Handling Resources...
[aapt] Found Deleted Target File
[aapt] Generating resource IDs...
-pre-compile:
-compile:
[javac] Compiling 42 source files to /Users/VIIAD/Desktop/VIIAD/VIIAD Ant/bin/classes
[javac] /Users/VIIAD/Desktop/VIIAD/VIIAD Ant/src/com/android/viiad/SearchResultsMapActivity.java:154: cannot find symbol
[javac] symbol : class OverlayItem
[javac] location: class com.android.viiad.SearchResultsMapActivity
[javac] public class SearchResultItemOverlay extends com.android.viiad.mapviewballoons.BalloonItemizedOverlay<OverlayItem> {
[javac] ^
[javac] 1 error
BUILD FAILED
/Users/VIIAD/android-sdk-macosx/tools/ant/build.xml:602: The following error occurred while executing this line:
/Users/VIIAD/android-sdk-macosx/tools/ant/build.xml:622: Compile failed; see the compiler error output for details.
是的,我確實有導入。 – 2012-01-03 16:32:49
@Sbossb將Eclipse項目轉換爲Ant是否有所作爲? – 2012-01-03 17:56:37
是的,這就是我將項目導入Ant的方式。由於我的項目需要Google Maps API,因此除了android.jar之外,我可能還需要包含maps.jar。我再看看吧。如果Eclipse構建它的工作正常,並且Ant可以在Eclipse完成後進行構建。但是,如果我清理項目並嘗試從源代碼構建Ant,則會收到錯誤消息。 – 2012-01-03 21:03:14