README.android
changeset 6650 d36232135316
parent 6646 dd32cce44d3c
child 6652 bb2a33ed8688
equal deleted inserted replaced
6646:dd32cce44d3c 6650:d36232135316
    46 If you want to use the Eclipse IDE, skip to the Eclipse section below.
    46 If you want to use the Eclipse IDE, skip to the Eclipse section below.
    47 
    47 
    48 5. Edit <project>/local.properties to point to the Android SDK directory
    48 5. Edit <project>/local.properties to point to the Android SDK directory
    49 6. Run 'ant debug' in android/project. This compiles the .java and eventually 
    49 6. Run 'ant debug' in android/project. This compiles the .java and eventually 
    50 creates a .apk with the native code embedded
    50 creates a .apk with the native code embedded
    51 7. 'ant install' will push the apk to the device or emulator (if connected)
    51 7. 'ant debug install' will push the apk to the device or emulator (if connected)
    52 
    52 
    53 Here's an explanation of the files in the Android project, so you can customize them:
    53 Here's an explanation of the files in the Android project, so you can customize them:
    54 
    54 
    55 android-project/
    55 android-project/
    56 	AndroidManifest.xml	- package manifest, do not modify
    56 	AndroidManifest.xml	- package manifest, do not modify
   274 If you need to build without optimization turned on, you can create a file called "Application.mk" in the jni directory, with the following line in it:
   274 If you need to build without optimization turned on, you can create a file called "Application.mk" in the jni directory, with the following line in it:
   275 APP_OPTIM := debug
   275 APP_OPTIM := debug
   276 
   276 
   277 
   277 
   278 ================================================================================
   278 ================================================================================
       
   279  Memory debugging
       
   280 ================================================================================
       
   281 
       
   282 The best (and slowest) way to debug memory issues on Android is valgrind.
       
   283 Valgrind has support for Android out of the box, just grab code using:
       
   284 	svn co svn://svn.valgrind.org/valgrind/trunk valgrind
       
   285 ... and follow the instructions in the file README.android to build it.
       
   286 
       
   287 One thing I needed to do on Mac OS X was change the path to the toolchain,
       
   288 and add ranlib to the environment variables:
       
   289 export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib
       
   290 
       
   291 Once valgrind is built, you can create a wrapper script to launch your
       
   292 application with it, changing org.libsdl.app to your package identifier:
       
   293 --- start_valgrind_app -------------------
       
   294 #!/system/bin/sh
       
   295 export TMPDIR=/data/data/org.libsdl.app
       
   296 exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
       
   297 ------------------------------------------
       
   298 
       
   299 Then push it to the device:
       
   300 	adb push start_valgrind_app /data/local
       
   301 
       
   302 and make it executable:
       
   303 	adb shell chmod 755 /data/local/start_valgrind_app
       
   304 
       
   305 and tell Android to use the script to launch your application:
       
   306 	adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
       
   307 
       
   308 If the setprop command says "could not set property", it's likely that
       
   309 your package name is too long and you should make it shorter by changing
       
   310 AndroidManifest.xml and the path to your class file in android-project/src
       
   311 
       
   312 You can then launch your application normally and waaaaaaaiiittt for it.
       
   313 You can monitor the startup process with the logcat command above, and
       
   314 when it's done (or even while it's running) you can grab the valgrind
       
   315 output file:
       
   316 	adb pull /sdcard/valgrind.log
       
   317 
       
   318 When you're done instrumenting with valgrind, you can disable the wrapper:
       
   319 	adb shell setprop wrap.org.libsdl.app ""
       
   320 
       
   321 
       
   322 ================================================================================
   279  Known issues
   323  Known issues
   280 ================================================================================
   324 ================================================================================
   281 
   325 
   282 - SDL audio (although it's mostly written, just not working properly yet)
   326 - SDL audio (although it's mostly written, just not working properly yet)
   283 - TODO. I'm sure there's a bunch more stuff I haven't thought of 
   327 - TODO. I'm sure there's a bunch more stuff I haven't thought of