我正在尝试用Ant构建我的Android项目。每当我使用Eclipse进行构建时,应用程序都会成功编译。然后我可以运行ant installd
并将应用程序的调试版本安装到我的设备上。但是,如果我运行ant clean
然后运行ant debug
,则构建失败,因为它找不到类OverlayItem。但是在project.properties中我有target=Google Inc.:Google APIs:4
。我做错了什么?
控制台输出
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.
答案 0 :(得分:1)
好吧它仍然让我感到困惑但是我修复了问题,将OverlayItem
替换为com.google.android.maps.OverlayItem
,即使我认为我有导入import com.google.android.maps.OverlayItem;
。
答案 1 :(得分:0)
您是否已将OverlayItem
导入com.android.viiad.SearchResultsMapActivity
?
import com.google.android.maps.OverlayItem;
编辑:假设您已完成所有导入,我会尝试converting the Eclipse project to use Ant。当然要备份原文。