AndEngine and Netbeans

AndEngine is a promising looking graphics engine for Android.

Especially as it has support for Box2D for the 2D physics.

Unfortunately there are few explanations to be found on setting it up for the Netbeans IDE in regards to making sure the native library is found.
I spent a good 1/2 day into trying to resolve the dreaded "java.lang.UnsatisfiedLinkError: Library andenginephysicsbox2dextension not found"

First of all an excellent tip came from here. This got me as for as an attempt to deploy the application with an error at the end that the apk was incorrectly signed.

Check out the AndEngineExamples project and copy the files into an Android netbeans project.

First of all modify your build.xml by adding these ant targets:

<target name="-pre-jar">
<copy todir="${build.classes.dir}">
<fileset dir="${external.lib.dir}">
<include name="*.jar"/>
</fileset>
</copy>
</target>
<target name="-post-jar">
<zip update="true" destfile="${dist.apk}_">
<zipfileset dir="${external.libs.dir}/armeabi" includes="*.so" prefix="lib/armeabi"/>
</zip>
<exec executable="${apkbuilder}" failonerror="true">
<arg value="${basedir}/${dist.apk}"/>
<arg value="-z"/>
<arg value="${basedir}/${dist.apk}_"/>
</exec>
<delete file="${dist.apk}_"/>
</target>

Next modify your nbproject/project.properties by adding:

external.lib.dir=lib
external.libs.dir=libs

Next edit nbproject/build-impl.xml and empty the -sign target:

<target depends="init,-package-res-and-assets,-package-res-no-assets,-package-dex" name="-sign">
<!-- <exec executable="${apkbuilder}" failonerror="true">
<arg value="${basedir}/${dist.apk}"/>
<arg value="-z"/>
<arg value="${basedir}/${dist.apk}_"/>
</exec>
<delete file="${dist.apk}_"/>-->
</target>

That's it, the physics examples should all work now.

Enjoy!