Android Examples

Notes

  • Only the Clothing and Destruction modules are supported on Android, so only samples with those features are distributed.
  • These samples have only been tested on Tegra3 devices and the APEX SDK for Android requires NEON support.
  • On Android 4.1, Jelly Bean, the keyboard in the samples will not hide using the standard “upside-down hat” button, please use the samples’ “keyboard” button.
  • The ground plane and triangle mesh floor rendering has been disabled on Android to reduce fill rate pressure and increase the FPS. The physical triangle mesh in the Destruction sample is actually higher than the debug rendered ground plane.

Running on Android

Prerequisites

These software packages are required to run and build the APEX Android projects:

* Android SDK
* Android NDK
* JDK
* Ant
* msys/cygwin (Windows), make (Linux, OSX) - (dos2unix is required as well)

Location of sample libs

The Android sample libs are found in:

* /samples/lib/android9

Location of sample APKs

The sample debug APKs are found in:

* /samples/AndroidActivities/SimpleClothing/bin
* /samples/AndroidActivities/SimpleDestruction/bin

Running the samples

  1. Connect the Android device in debug mode and ensure that you can connect to it with adb (the adb logcat command is a good connection test)
  2. Copy the /media folder to the device’s /sdcard folder (there are extra files than what is required, it has not been pruned to just the sample files)
  3. Install the apk file: adb install SimpleClothing-debug.apk

To pass command line arguments to the samples, create a /sdcard/media/APEX/1.3/SimpleClothing/commandline.txt file and add different args

  • For SimpleClothing: –scene 1 –numactors 5
  • For SimpleDestruction: –hallmark –numactors 10

Building the samples

To rebuild the Sample APKs

  1. Define NDKROOT (path to the NDK supporting NEON instruction set), NXPATH (PhysX path), JAVA_HOME, and ANT_TOOL in /samples/compiler/android9/Makefile
  2. Makedefs.ANDROID9.mk file contains logic which tries to setup build environment to use latest possible gcc found in the NDK path supplied. You might want to change that logic to reflect your specific cases.
  3. Run make profile to generate the profile samples (‘make’ utility could be found in msys/mingw package. Add its bin to the $PATH). You can also add ‘-jN’ (N = number of cores/CPUs) option to speed up the build process.
  4. Edit the /samples/AndroidActivities/Simple[Destruction, Clothing]/local.properties file and change the sdk.dir line to point to your Android SDK folder (forward slashes or double back-slashes)

To install the APKs

  1. From the /samples/AndroidActivities/Simple[Destruction, Clothing] folder, run ant release install
  2. The sample should be installed on the device at this point, simply find the NVIDIA PhysX icon and click to run

Note

The sample manifest is set to build an apk file with the profile configuration. To build an apk with a different configuration you will need to edit the manifest.