简体   繁体   中英

Ant Build Android Project With Dependencies

I'm trying to build an app (let's call it android-app ) with a dependency on an SDK (let's call it sdk ) via Ant. Eclipse is not installed on this computer (for reasoning, it's a CI box with Jenkins).

Both projects are in two completely separate directories side by side. android-app is in the directory ~/.jenkins/jobs/android-app/workspace and sdk is in the directory ~/.jenkins/jobs/sdk/workspace .

Let's assume both projects are "vanilla" and have not been built with Ant before. I cd to the ../android-app/workspace directory and run android update project -p . --library ~/.jenkins/jobs/sdk/workspace android update project -p . --library ~/.jenkins/jobs/sdk/workspace which passes. I then cd to the ../sdk/workspace directory and run android update project -p . which also passes.

At this point I cd back to the ../android-app/workspace directory and run ant clean build . It fails with the error:

BUILD FAILED
/path/to/ant/build.xml:440: 
/path/to/sdk/workspace resolve to a path with no project.properties file for 
project /path/to/android-app/workspace

... where /path/to is the full path to the directories. I simplified it here.

If I cd to the sdk workspace and open project.properties , I receive the following:

# ProGuard
proguard.config=proguard.cfg

# Project target.
target=android-10
android.library=true

It does exist. So do all of these files:

LS

So, why is this failing? What am I doing wrong? I tried to provide as many details as possible. Please let me know if I can provide anything additional.

Well, I encounter this problem too.

I use strace to find out what the hell is going on and found that the path you specified in project.properties will be appended with your current folder path as its prefix.

For example, /home/myfolder/project > ant debug

And the library you specified in project.properties is /path/to/library

Then, the path will become /home/myfolder/project/path/to/library

Just to fill in the answer gap here, my Java version was completely off. I'm super embarrassed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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