简体   繁体   English

使用Google API时Ant无法构建

[英]Ant fails to build when using Google APIs

I am trying to build my Android project with Ant. 我正在尝试使用Ant构建我的Android项目。 Whenever I use Eclipse to do the build the app compiles sucessfully. 每当我使用Eclipse进行构建时,应用程序都会成功编译。 I am then able to run a ant installd and install the debug version of the app to my device. 然后,我可以运行ant installd并将该应用程序的调试版本安装到我的设备上。 However if I run a ant clean and then run ant debug the build fails beccause it can not find the class OverlayItem. 但是,如果我先运行一次ant clean ,然后再运行ant debug则构建失败,因为它找不到类OverlayItem。 However in the project.properties I have target=Google Inc.:Google APIs:4 . 但是在project.properties中,我具有target=Google Inc.:Google APIs:4 What am I doing wrong? 我究竟做错了什么?

Console Output 控制台输出

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.

Well it still perplexes me but I fixed the problem by replacing OverlayItem with com.google.android.maps.OverlayItem even thought I had the import import com.google.android.maps.OverlayItem; 好吧,它仍然让我感到困惑,但我什至认为我已经import com.google.android.maps.OverlayItem;我还是用com.google.android.maps.OverlayItem替换了OverlayItem来解决了这个问题import com.google.android.maps.OverlayItem; .

Did you import OverlayItem into com.android.viiad.SearchResultsMapActivity ? 您是否将OverlayItem导入com.android.viiad.SearchResultsMapActivity

import com.google.android.maps.OverlayItem;

Edit: Assuming you have all your imports in place, I would try converting the Eclipse project to use Ant . 编辑:假设所有导入都已到位,我将尝试将Eclipse项目转换为使用Ant Do make a backup of the original of course. 当然要备份原始文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM