User:Blassey/Notes/Android: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 12: Line 12:


Nvidia's gdb is better: http://developer.download.nvidia.com/tegra/files/tegra-gdb-20100430.zip
Nvidia's gdb is better: http://developer.download.nvidia.com/tegra/files/tegra-gdb-20100430.zip
In order to attach before things get running, launch with:
  adb shell am start -a org.mozilla.gecko.DEBUG -n org.mozilla.fennec/org.mozilla.fennec.App
and just click launch once gdb is attached. If you need to debug a crash that happens before XRE_Main is called, the patch on {{bug|572247}} may be useful.
===Env Vars===
If you need to set and env var at run time, use append --es env# VAR=VAL to your activity manager command where # is the ordered number of variables for example:
  adb shell am start -a android.activity.MAIN -n org.mozilla.fennec/org.mozilla.fennec.App --es env0 VAR=val --es env1 FOO=bar
You may need {{bug|578493}} if the env var you're using is tested before XRE_Main is called


===PR Logging===
===PR Logging===
You can use the env vars as described above to make logging work (along with {{bug|578493}}. With just that you can log to a file
  adb shell am start -a android.activity.MAIN -n org.mozilla.fennec/org.mozilla.fennec.App --es env0 NSPR_LOG_MODULES=all:5 --es env1 NSPR_LOG_FILE=/mnt/sdcard/log.txt
With the patch on {{bug|578496}} you can have the logging directed to the android logs and as such only need:
  adb shell am start -a android.activity.MAIN -n org.mozilla.fennec/org.mozilla.fennec.App --es env0 NSPR_LOG_MODULES=all:5

Revision as of 23:50, 13 July 2010

Build Env

After normal linux build pre-reqs:

 wget ftp://ftp.mozilla.org/pub/mobile/source/android-ndk-r4c-0moz3.tar.bz2
 wget http://dl.google.com/android/android-sdk_r06-linux_86.tgz
 tar -xf android-sdk_r06-linux_86.tgz
 tar -xjf android-ndk-r4-linux-x86-crystax-1.tar.bz2
 ./android-sdk-linux_86/tools/android update sdk

Debugging

Nvidia's gdb is better: http://developer.download.nvidia.com/tegra/files/tegra-gdb-20100430.zip

In order to attach before things get running, launch with:

  adb shell am start -a org.mozilla.gecko.DEBUG -n org.mozilla.fennec/org.mozilla.fennec.App

and just click launch once gdb is attached. If you need to debug a crash that happens before XRE_Main is called, the patch on bug 572247 may be useful.

Env Vars

If you need to set and env var at run time, use append --es env# VAR=VAL to your activity manager command where # is the ordered number of variables for example:

 adb shell am start -a android.activity.MAIN -n org.mozilla.fennec/org.mozilla.fennec.App --es env0 VAR=val --es env1 FOO=bar

You may need bug 578493 if the env var you're using is tested before XRE_Main is called

PR Logging

You can use the env vars as described above to make logging work (along with bug 578493. With just that you can log to a file

 adb shell am start -a android.activity.MAIN -n org.mozilla.fennec/org.mozilla.fennec.App --es env0 NSPR_LOG_MODULES=all:5 --es env1 NSPR_LOG_FILE=/mnt/sdcard/log.txt

With the patch on bug 578496 you can have the logging directed to the android logs and as such only need:

 adb shell am start -a android.activity.MAIN -n org.mozilla.fennec/org.mozilla.fennec.App --es env0 NSPR_LOG_MODULES=all:5