简体   繁体   English

当我使用Ant来构建具有多个库的Android项目时,我的构建失败了

[英]My build fails when I use Ant to build and Android project with multiple libraries

I have an app which contains a total of 10 projects: 3 java projects, 6 Android projects, and one Android app project. 我有一个应用程序,其中包含总共10个项目:3个Java项目,6个Android项目和一个Android应用程序项目。 I can build them in Eclipse without errors, but when I build them in Jenkins, the build fails during compilation of the last project. 我可以在Eclipse中构建它们而不会出错,但是当我在Jenkins中构建它们时,在编译最后一个项目时构建失败了。

Here are the shell commands that I'm using to do the build. 以下是我用于构建的shell命令。

Just to be clear, DrawCard and CameraModule are libraries that are invoked by CC_library3.0.3, and CC_library3.0.3 is a library project invoked by MainApp. 需要说明的是,DrawCard和CameraModule是由CC_library3.0.3调用的库,而CC_library3.0.3是由MainApp调用的库项目。

android update lib-project -p ./DrawCard  -t "android-15"  
android update lib-project -p ./AppStar  -t "android-15"
android update lib-project -p ./CameraModule   -t "android-15"
android update lib-project -p ./CC_library3.0.3   -t "android-15" 
android update lib-project -p ./ISAd  -t "android-15"
android update lib-project -p ./Payment  -t "android-15"
android update project -p ./MainApp -t "android-15" -l ../CC_library3.0.3 -l ../ISAd -l ../Payment

echo 'source.dir=../android-vcard/src' > ./DrawCard/ant.properties
echo 'source.dir=../TianShu/src' > ./MainApp/ant.properties
echo 'source.dir=../Log4A/src' >> ./MainApp/ant.properties
cd ./MainApp
ant all clean debug

After those commands, when building MainApp, the process fails with this message: 在这些命令之后,在构建MainApp时,该过程将失败并显示以下消息:

[javac]Compiling 22 source files to /var/lib/jenkins/foobar/bin/classes
[javac]A.java : package a.b.c does not exist
....
[javac]B.java : can not find symble

.....
BUILD FAILED

I don't understand why I'm getting this error. 我不明白为什么我会收到这个错误。 I checked the /bin folder of all 6 lib-projects. 我检查了所有6个lib项目的/bin文件夹。 Each contains a classes.jar file. 每个包含classes.jar文件。 Why is this happening and what can I do about it? 为什么会发生这种情况,我该怎么办呢?

I don't think that you can submit multiple libraries in the same call of android update project like you did. 我不认为你可以像你一样在android update project的同一个调用中提交多个库。 I think each entry of -l silently overwrites the previous ones. 我认为-l每个条目都会默认覆盖以前的条目。 Try running the command once for each library instead: 尝试为每个库运行一次命令:

android update project -p ./MainApp -t "android-15" -l ../CC_library3.0.3
android update project -p ./MainApp -t "android-15" -l ../ISAd
android update project -p ./MainApp -t "android-15" -l ../Payment

After that open your ./MainApp/project.properties and make sure you have the following entries: 之后打开./MainApp/project.properties并确保您有以下条目:

android.library.reference.1=../CC_library3.0.3
android.library.reference.2=../ISAd
android.library.reference.3=../Payment

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

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