Recent

Author Topic: Improvements to build.sh for better debugging  (Read 2290 times)

meanderix

  • Jr. Member
  • **
  • Posts: 50
Improvements to build.sh for better debugging
« on: April 28, 2012, 01:01:41 am »
Hi,

Thought I'd share my slightly modified version of build.sh, which has some improvements:
  • It extracts the proper package name from the XML manifest;
  • It clears the log file (so that you avoid dumping many pages of useless info);
  • It automatically starts the app using "adb shell am start";
  • It adds a filter to logcat so that we capture (mostly) the messages related to our app.

Code: Text  [Select]
  1. #!/bin/bash
  2. # get package name from XML manifest
  3. PACKAGENAME=`xmllint --xpath "string(/manifest/@package)" AndroidManifest.xml`
  4. # build .apk file in bin folder
  5. ant debug
  6. # uninstall previous version of app
  7. adb uninstall $PACKAGENAME
  8. # install new version
  9. adb install bin/LCLExample-debug.apk
  10. # clear log file
  11. adb logcat -c
  12. # start app
  13. adb shell am start -a android.intent.action.MAIN -n $PACKAGENAME/.LCLActivity
  14. # capture only debug messages that are related to our app
  15. adb logcat lclapp,DEBUG,dalvikvm:I *:S
  16.