简体   繁体   中英

Build Android Library Project With Ant

I am having trouble building my Android library project with ant. When I try to run ant release , it says Target "release" does not exist in the project "MyProject" .

I then assumed that perhaps libraries do not get build with release/debug, so I started using ant compile , which seems to work. I then zip the folder manually using java's zip utility and rename it to .apk. I am guessing this is the wrong way to do this.

Can anyone show me how to build an Android library project using ant?

I then assumed that perhaps libraries do not get build with release/debug

Correct.

I am guessing this is the wrong way to do this.

Also correct.

Can anyone show me how to build an Android library project using ant?

You typically do not build an Android library project. You build other projects that reference the Android library project. Creating projects that reference the library project, for use with Ant, is covered in the Android documentation . More information about the role of Android library projects can also be found in the Android documentation .

I had the same trouble with a target "nodeps" that was not known by Ant when building a project that was referencing a library. I added a fake target "nodeps", then I get the target "release" unknown. Wrong way.

Solution : in my referenced library directory, I run the command android update project -p . that created the build.xml compatible with Ant build.

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