当前位置: 首页 > 知识库问答 >
问题:

用蚂蚁构建Android项目-找不到符号

养俊驰
2023-03-14

我试图使用ant构建我的android项目(它在eclipse中运行良好)。我运行了以下生成失败行的错误:

BUILD FAILED
.../android_sdks/tools/ant/build.xml:680: The following error occurred while executing this line:
.../android_sdks/tools/ant/build.xml:693: Compile failed; see the compiler error output for details.
android update project --path .
-check-env:
[checkenv] Android SDK Tools Revision 20
[checkenv] Installed at [path]/android_sdks

-setup:
 [echo] Project Name: SplashActivity
 [gettype] Project Type: Application
 [echo] Switching between debug and non debug build: Deleting previous compilation output...
 [delete] Deleting directory [android_path]/bin/classes

-pre-clean:

clean:
 [delete] Deleting directory [android_path]/bin
 [delete] Deleting directory [android_path]/gen
 [getlibpath] Library dependencies:
 [getlibpath] No Libraries
 [subant] No sub-builds to iterate on

  ###removed some code#####
 -build-setup:
  [echo] Resolving Build Target for SplashActivity...
  [gettarget] Project Target:   Android 2.1
  [gettarget] API level:        7
  [echo] ----------
  [echo] Creating output directories if needed...
  [mkdir] Created dir: [android_path]/bin
  [mkdir] Created dir: [android_path]/bin/res
  [mkdir] Created dir: [android_path]/gen
  [mkdir] Created dir: [android_path]/bin/classes
  [echo] ----------
  [echo] Resolving Dependencies for SplashActivity...
   [dependency] Ordered libraries:
   [dependency] 
   [dependency] ------------------
   [dependency] API<=15: Adding annotations.jar to the classpath.
   [echo] ----------
   [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

 -pre-build:

 -code-gen:
    [mergemanifest] Merging AndroidManifest files into one.
    [mergemanifest] Manifest merger disabled. Using project manifest only.
    [echo] Handling aidl files...
    [aidl] Found 1 AIDL files.
    [aidl] Compiling 1 AIDL files.
    [echo] ----------
    [echo] Handling RenderScript files...
    [renderscript] No RenderScript files to compile.
    [echo] ----------
    [echo] Handling Resources...
    [aapt] Generating resource IDs...
    [echo] ----------
    [echo] Handling BuildConfig class...
    [buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
[javac] Compiling 263 source files to [android_path]/bin/classes
[javac] [android_path]/src/com/[company]/firstbase/AbstractFirstBaseActivity.java:447: warning: unmappable character for encoding UTF-8

#####removed a lot of similar warnings######

[javac] [android_path]/src/com/[company]/firstbase/models/[company]Match.java:14: cannot find symbol
[javac] symbol  : class MatchExpiryComparator
[javac] location: package com.[company].firstbase.util
[javac] import com.[company].firstbase.util.MatchExpiryComparator;
[javac]                                  ^
[javac] [android_path]/src/com/[company]/firstbase/models/[company]Match.java:21: cannot find symbol
[javac] symbol  : class MatchExpiryComparator
[javac] location: class com.[company].firstbase.models.[company]Match
[javac]     public static MatchExpiryComparator EXPIRATION_SORT_COMPARATOR = new MatchExpiryComparator();
[javac]                   ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:12: cannot find symbol
[javac] symbol  : class DashboardActivity
[javac] location: package com.[company].firstbase
[javac] import com.[company].firstbase.DashboardActivity;
[javac]                             ^
[javac] [android_path]/src/com/[company]/firstbase/FirstBaseApplication.java:178: warning: non-varargs call of varargs method with inexact argument type for last parameter;
[javac] cast to java.lang.Object for a varargs call
[javac] cast to java.lang.Object[] for a non-varargs call and to suppress this warning
[javac]                         facebookData.put(key, Utils.stringJoin(",", entries));
[javac]                                                                     ^
[javac] [android_path]/src/com/[company]/firstbase/misc/Panel.java:189: cannot find symbol
[javac] symbol  : variable panelHandle
[javac] location: class com.[company].firstbase.R.id
[javac]         mHandle = findViewById(R.id.panelHandle);
[javac]                                    ^
[javac] [android_path]/src/com/[company]/firstbase/misc/Panel.java:193: cannot find symbol
[javac] symbol  : variable panelContent
[javac] location: class com.[company].firstbase.R.id
[javac]         mContent = findViewById(R.id.panelContent);
[javac]                                     ^
[javac] [android_path]/src/com/[company]/firstbase/models/[company]Match.java:21: cannot find symbol
[javac] symbol  : class MatchExpiryComparator
[javac] location: class com.[company].firstbase.models.[company]Match
[javac]     public static MatchExpiryComparator EXPIRATION_SORT_COMPARATOR = new MatchExpiryComparator();
[javac]                                                                          ^
[javac] [android_path]/src/com/[company]/firstbase/models/[company]Match.java:56: cannot find symbol
[javac] symbol  : variable USERS_USERID
[javac] location: class com.[company].firstbase.db.DbHelper
[javac]         this.userID = Utils.descryptForDB(c.getString(c.getColumnIndexOrThrow(DbHelper.USERS_USERID)));
[javac]                                                                                       ^
[javac] [android_path]/src/com/[company]/firstbase/models/[company]Match.java:57: cannot find symbol
[javac] symbol  : variable USERS_USERNAME
[javac] location: class com.[company].firstbase.db.DbHelper
[javac]         this.username = c.getString(c.getColumnIndexOrThrow(DbHelper.USERS_USERNAME));
[javac]                                                                     ^
[javac] [android_path]/src/com/[company]/firstbase/models/[company]Match.java:58: cannot find symbol
[javac] symbol  : variable USERS_PHOTO
[javac] location: class com.[company].firstbase.db.DbHelper
[javac]         this.photoURI = c.getString(c.getColumnIndexOrThrow(DbHelper.USERS_PHOTO));
[javac]                                                                     ^

 #######Removed a lot of similar errors ##########


[javac]                                                                            ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:21: cannot find symbol
[javac] symbol  : variable widget_layout
[javac] location: class com.[company].firstbase.R.layout
[javac]             RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
[javac]                                                                                   ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:23: cannot find symbol
[javac] symbol  : variable DashboardActivity
[javac] location: class com.[company].firstbase.widget.[company]Widget
[javac]             int count = DashboardActivity.mMatchesCalloutCount+DashboardActivity.mConnectionsCalloutCount;
[javac]                         ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:23: cannot find symbol
[javac] symbol  : variable DashboardActivity
[javac] location: class com.[company].firstbase.widget.[company]Widget
[javac]             int count = DashboardActivity.mMatchesCalloutCount+DashboardActivity.mConnectionsCalloutCount;
[javac]                                                                ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:23: incompatible types
[javac] found   : java.lang.String
[javac] required: int
[javac]             int count = DashboardActivity.mMatchesCalloutCount+DashboardActivity.mConnectionsCalloutCount;
[javac]                                                               ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:27: cannot find symbol
[javac] symbol  : variable callout
[javac] location: class com.[company].firstbase.R.id
[javac]                 views.setTextViewText(R.id.callout, count+"");
[javac]                                           ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:28: cannot find symbol
[javac] symbol  : variable callout
[javac] location: class com.[company].firstbase.R.id
[javac]                 views.setViewVisibility(R.id.callout, View.VISIBLE);
[javac]                                             ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:31: cannot find symbol
[javac] symbol  : variable callout
[javac] location: class com.[company].firstbase.R.id
[javac]                 views.setViewVisibility(R.id.callout, View.GONE);
[javac]                                             ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:34: cannot find symbol
[javac] symbol  : class DashboardActivity
[javac] location: class com.[company].firstbase.widget.[company]Widget
[javac]             Intent intent = new Intent(context, DashboardActivity.class);
[javac]                                                 ^
[javac] [android_path]/src/com/[company]/firstbase/widget/[company]Widget.java:37: cannot find symbol
[javac] symbol  : variable widget_heart
[javac] location: class com.[company].firstbase.R.id
[javac]             views.setOnClickPendingIntent(R.id.widget_heart, pendingIntent);
[javac]                                               ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 40 errors
[javac] 21 warnings

构建失败[path]/android_sdks/tools/ant/BUILD.xml:680:执行这一行时发生以下错误:[path]/android_sdks/tools/ant/BUILD.xml:693:编译失败;有关详细信息,请参阅编译器错误输出。

总时间:6秒

共有1个答案

闾丘谦
2023-03-14

想通了:

我在Eclipse上排除了buildpath上的文件。显然,蚂蚁的情况并非如此。我没有在Ant文件上添加大量的文件,而是删除了这些文件,事情就解决了。

 类似资料:
  • 我在eclipse中有两个独立的项目:“project”和“pinclude” 项目包括p包括,所以没有以某种方式包括该项目的java文件在我的build.xml内,javac将始终返回错误。 我是怎么做到的。ant/javac中的类文件?我尝试过寻找解决方案,但到目前为止,我只找到了添加jar文件的方法。会创造一个装满所有“夹心”的罐子。类文件解决了我的问题?。 谢谢你的帮助。 注: 我为糟糕的

  • 问题内容: 我试图在Eclipse中使用Ant构建项目。我右键单击build.xml>运行方式> Ant Build。但是,我收到以下错误: 还有一个警告: 正如我在其他文章中所读到的那样,这可能是由于ant版本太旧或未正确设置环境变量所致,这里是所有信息: 编辑:这是整个build.xml,第26行是javac标记: 问题答案: 与您的Eclipse版本捆绑在一起的Ant版本与Java 1.8不

  • 当我在命令行中输入Ant时。。我犯了以下错误。。 找不到工具。罐子应该可以在C:\Program Files\Java\jre6\lib\tools中找到。jarbuildfile:build。xml不存在!构建失败

  • 我正在尝试使用Ant将eclipse项目构建为.jar。 我的目录结构是: / 下面是我的build.xml: 该事物正确构建,并生成一个JAR。但是,当我使用:java-jar dynamdns.jar运行jar时 我收到错误:错误:找不到或加载主类DynamDns.Connector 有人有什么想法吗?

  • 我正在尝试为Android Xamarin应用程序创建一个启动屏幕 启动屏幕应该是一个背景,上面有一个徽标。 到目前为止,我设法显示了背景。 使用此布局 启动屏幕工作正常 添加徽标会产生问题。(只是在背景项后面添加了这段代码) 应用程序停止构建。 除了在构建过程中发生的错误之外,我没有收到任何错误消息。 这是我正在使用的样式

  • 问题内容: 我正在尝试使用BuildFile(build.xml)在Ant中构建项目。尽管ANT_HOME环境变量明显存在并且设置为“ ant.bat”所在的路径,但它始终显示此错误消息。如何正确配置Ant以在Windows中编译版本? 谢谢 问题答案: 可以设置ANT_HOME,但这并不意味着/ bin的路径在您的PATH中,因此OS可以找到它。 将ANT_HOME / bin添加到您的PATH