Home » Android » Build Android Library Project With Ant

Build Android Library Project With Ant

Posted by: admin June 15, 2020 Leave a comment

Questions:

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?

How to&Answers:

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.

Answer:

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.