Jesse
Jesse

Reputation: 43

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. I can build them in Eclipse without errors, but when I build them in Jenkins, the build fails during compilation of the last project.

Here are the shell commands that I'm using to do the build.

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.

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:

[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. Each contains a classes.jar file. Why is this happening and what can I do about it?

Upvotes: 4

Views: 992

Answers (1)

alexgophermix
alexgophermix

Reputation: 4279

I don't think that you can submit multiple libraries in the same call of android update project like you did. I think each entry of -l silently overwrites the previous ones. 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:

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

Upvotes: 2

Related Questions