Android deploy script

#1

When I deploy a new .apk to my Android device, I use this script: android_deploy.sh.
This allows me to uninstall, install and run the app with one line:

> ./android_deploy.sh mybundle.apk

And here is a sample output:

mathiaswesterdahl@ ~/work/bundles $ ../scripts/android-deploy.sh armv7-android/Bunnymark/Bunnymark.apk 
Package name = com.britzl.bunnymark
Uninstalling com.britzl.bunnymark
    Failure
Installing com.britzl.bunnymark
    [  2%] /data/local/tmp/Bunnymark.apk
    [ 25%] /data/local/tmp/Bunnymark.apk
    [ 51%] /data/local/tmp/Bunnymark.apk
    [ 74%] /data/local/tmp/Bunnymark.apk
    [100%] /data/local/tmp/Bunnymark.apk
    armv7-android/Bunnymark/Bunnymark.apk: 1 file pushed. 6.7 MB/s (2811281 bytes in 0.401s)
    	pkg: /data/local/tmp/Bunnymark.apk
    Success
Launching com.britzl.bunnymark
Events injected: 1
## Network stats: elapsed time=454ms (0ms mobile, 454ms wifi, 0ms not connected)
PID=21734
V/threaded_app(21734): Creating: 0x41be8d50
V/threaded_app(21734): Config: mcc=0 mnc=0 lang=en cnt=US orien=1 touch=3 dens=320 keys=1 nav=1 keysHid=3 navHid=0 sdk=18 size=2 long=2 modetype=1 modenight=1
V/glfw-android(21734): _glfwPreMain
D/dalvikvm(21734): Trying to load lib /data/app-lib/com.britzl.bunnymark-1/libBunnymark.so 0x42650150
D/dalvikvm(21734): Added shared lib /data/app-lib/com.britzl.bunnymark-1/libBunnymark.so 0x42650150
D/dalvikvm(21734): No JNI_OnLoad found in /data/app-lib/com.britzl.bunnymark-1/libBunnymark.so 0x42650150, skipping init
V/threaded_app(21734): Start: 0x41be8d50
V/threaded_app(21734): activityState=10
V/glfw-android(21734): handleCommand: APP_CMD_START
V/threaded_app(21734): Resume: 0x41be8d50
V/threaded_app(21734): activityState=11
V/glfw-android(21734): handleCommand: APP_CMD_RESUME
V/threaded_app(21734): InputQueueCreated: 0x41be8d50 -- 0x58f8fb98
V/threaded_app(21734): APP_CMD_INPUT_CHANGED
V/threaded_app(21734): Attaching input queue to looper
V/glfw-android(21734): handleCommand: APP_CMD_INPUT_CHANGED
V/threaded_app(21734): NativeWindowCreated: 0x41be8d50 -- 0x58f911b0
V/threaded_app(21734): APP_CMD_INIT_WINDOW
V/glfw-android(21734): handleCommand: APP_CMD_INIT_WINDOW
V/threaded_app(21734): WindowFocusChanged: 0x41be8d50 -- 1
V/glfw-android(21734): handleCommand: APP_CMD_GAINED_FOCUS
V/glfw-android(21734): _glfwPlatformInit
V/glfw-android(21734): init_gl
D/libEGL  (21734): loaded /system/lib/egl/libEGL_mali.so
D/libEGL  (21734): loaded /system/lib/egl/libGLESv1_CM_mali.so
D/libEGL  (21734): loaded /system/lib/egl/libGLESv2_mali.so
E/        (21734): Device driver API match
E/        (21734): Device driver API version: 23
E/        (21734): User space API version: 23 
E/        (21734): mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct  9 21:05:57 KST 2013 
V/glfw-android(21734): create_gl_aux_context..
V/glfw-android(21734): create_gl_aux_context success
D/push    (21734): Push started (com.defold.push.PushJNI@42696628 )
V/glfw-android(21734): _glfwPlatformOpenWindow
V/glfw-android(21734): create_gl_surface
I/Reverb  (21734):  getpid() 21734, IPCThreadState::self()->getCallingPid() 21734
14 Likes

Virtual game pad example
Admob newbie question (SOLVED)
#2

Because I jump around between different projects all the time I did this a slightly different way. I have a python (3.4 or more recent required) script that uses adb and bob. Guess I may as well dump it here too.

It can build, install, uninstall, start and listen. It uses bob, you can set your own by giving it the sha of that version or use the most current version.

I use it like this

> cd repo/bug_reports/gui_position/
> builder bob --update
Downloading new bob 0faa10db6bb28907d67358ad5810f3962437f3fd
[==================================================]%
> builder build .
100%
> builder install . --force
Success
[100%] /data/local/tmp/Empty project.apk
	pkg: /data/local/tmp/Empty project.apk
Success
> builder start
Starting: Intent { cmp=com.example.todo/com.dynamo.android.DefoldActivity }
> builder listen
--------- beginning of main
--------- beginning of system

The . indicates current location/project and is what I use. You could specify a apk or such but that kinda defeats the purpose of this script :stuck_out_tongue: Maybe I should just have . as the default :thinking:

The script is distributed “as is”, I haven’t tested it on a Windows machine - I haven’t tested it on any different setup than my own to be honest, but it should work.

8 Likes

#6

Updated the script to support pidcat and logcat-color:

Here’s a screenshot using pidcat:

7 Likes