Skip to content Skip to sidebar Skip to footer

Renaming Classes.jar To .jar While Building A Library Project In Android Ant

I have an android application project A which depends on an Android Library project B. when i import both the projects in Eclipse,I've notice the Eclipse Builder (probably due to t

Solution 1:

Create a custom_rules.xml file in your project director.

<?xml version="1.0" encoding="UTF-8"?><projectname="custom_rules"><targetname="-post-compile"><echolevel="info">Renaming jar filename</echo><movefile="${out.library.jar.file}"tofile="${out.absolute.dir}/${ant.project.name}.jar"/></target></project>

Solution 2:

One way to rename the jar file is to add a custom_rules.xml file to the project, and override the right property:

<?xml version="1.0" encoding="UTF-8"?><projectname="custom_rules"><propertyname="out.library.jar.file"location="bin/b.jar" /></project>

If you look for this property name in the SDK's build.xml, you'll see why this works.

Note: I did not check from which API level the custom_rules.xml is supported by Android.

Solution 3:

Solution 4:

The simplest way is added a line to ant.properties:

out.library.jar.file=bin/b.jar

But if project B is referenced by project A in project-A/ant.properties like:

android.library.reference.1=/path/to/project-B

then compiler may complain that it cannot find symbols defined in project B.

Post a Comment for "Renaming Classes.jar To .jar While Building A Library Project In Android Ant"