Java – when I build an Android project with multiple libraries using ant, my build fails

I have an application that contains a total of 10 projects: 3 Java projects, 6 Android projects and 1 Android application project I could build them in eclipse without errors, but when I built them in Jenkins, the build failed when compiling the last project

Here are the shell commands I use to build

It should be noted that drawcard and cameramodule are controlled by CC_ library3. 0.3 called library, while CC_ library3. 0.3 is a library item called 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 these commands, when building mainapp, the process will fail with the following 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 received this error I checked the / bin folder of all six lib projects Each contains classes Jar file Why did this happen and what should I do?

Solution

I don't think you can submit multiple libraries in the same call of Android update project as you do I think each entry of - l will overwrite the previous entry by default

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

Then open it/ 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
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>