Forum > Android

Improvements to build.sh for better debugging

(1/1)

meanderix:
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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---#!/bin/bash# get package name from XML manifestPACKAGENAME=`xmllint --xpath "string(/manifest/@package)" AndroidManifest.xml`# build .apk file in bin folderant debug# uninstall previous version of appadb uninstall $PACKAGENAME# install new versionadb install bin/LCLExample-debug.apk# clear log fileadb logcat -c# start appadb shell am start -a android.intent.action.MAIN -n $PACKAGENAME/.LCLActivity# capture only debug messages that are related to our appadb logcat lclapp,DEBUG,dalvikvm:I *:S 

Navigation

[0] Message Index

Go to full version