2010-08-16

Adding a jar to an Android project in Netbeans

If you add a jar to an Android project in Netbeans, it will compile but classes included in that jar won't be included in apk package.

there is a solution to this problem, add these lines in build.xml file


<target name="-pre-jar">
<copy todir="${build.classes.dir}">
<fileset file="${file.reference.YOURJAR.jar}" />
</copy>
</target>


change YOURJAR for the apropiate value that you will find in project.properties

in my case I've found

file.reference.core.jar=../core/dist/core.jar


so I've added these lines

<target name="-pre-jar">
<copy todir="${build.classes.dir}">
<fileset file="${file.reference.core.jar}" />
</copy>
</target>

No hay comentarios: