Trouble running the PhysicsEffects examples in Android

belgianguy
Posts: 2
Joined: Fri May 18, 2012 10:00 pm

Trouble running the PhysicsEffects examples in Android

Post by belgianguy »

I saw the headline and set out to try the PhysicsEffects examples on my Android phone.

I'm using:
- Ubuntu 12.04
- Android NDK r8
- Target Android platform 2.3.3 (my phone runs 2.3.7)
- Ant 1.8.2
- Bullet release 2.80 SP1 rev2531 (Unix line endings)


I used ndk-build to build the PfxLibrary and afterwards I built the PfxApp_1_Simple using the ndk-build command, all seemingly ok.

Per the readme I then ran 'ant compile', but this gave errors, mainly stating that the project needed updating by using "android update project". This forced me to remove the original build.xml, and I ran "android update project --target 1 -p ../PfxApp_1_Simple', after which new files were generated.

But after running "ant compile" again after this operation, it told me the Android sdk could not be located. I found out the sdk location being pointed to by the file 'local.properties' assumed it to be on a (non-existing) drive named F:, in Windows notation. After changing that to my actual android sdk location, I once again ran 'ant compile', only to be greeted by another error: Target "compile" does not exist in the project "PfxApp_1_Simple".

So then I tried to run "ant debug", which did work and generated a slew of APK files. But when I install them trough "ant debug install" or when I try to run them on the phone through Eclipse, they all crash.

Any idea on what I'm doing wrong? I added the output Eclipse generated when I tried to use it to run PfxApp_1_Simple on my phone.
You do not have the required permissions to view the files attached to this post.
belgianguy
Posts: 2
Joined: Fri May 18, 2012 10:00 pm

Re: Trouble running the PhysicsEffects examples in Android

Post by belgianguy »

Success!

Found some help in the #android-dev IRC channel, they helped me out tremendously (especially thanks to 'readme').

- Ubuntu 12.04
- Android NDK r8
- Target Android platform 4.0.3
- Ant 1.8.2
- Latest Bullet release from SVN (r2537 at the time of writing)

1. Android.mk variable name: Perhaps one should consider renaming the variable called BULLET_PFX_ROOT_CYGWIN to something more generic/not OS-specific?
On an Ubuntu installation, I do not have (or need :p) Cygwin, which is a little confusing. My suggestion is to rename it to BULLET_PFX_ROOT, but to tell Windows users to make sure it's placed below the Cygwin directory.


2. ant compile: While the readme says to use this command, I was not able to use it. It gave me this error:

BUILD FAILED
Target "compile" does not exist in the project "PfxApp_3_Sleep".

The solution is to just use "ant debug" and "ant release" instead. Perhaps that advice could be incorporated into the readme as well?

3. Building the PfxApps: Ant initially complained about the build.xml files being outdated. Here I deleted the current build.xml and ran the following command in each PfxApp_* directory to regenerate it (and other needed files):

android update project --target 8 --path .

--target points to the target platform ID (in this case 8 points to 4.0.3 Google API), a full list of target ids is available by running the "android list targets" command
--path points to the current directory (the dot following it)

So after setting the Environment variable, and building the PfxLibrary with ndk-build, you could run the following command in each project directory:

rm build.xml && ndk-build && android update project --target 8 --path . && ant debug

and then find the *.apk files in the /bin directory

4. Installing: I used "adb install PfxApp_1_Simple-debug.apk", using Eclipse to launch an Android Emulator and the sample showed up and worked.