4.2.1. General Hints¶
4.2.1.1. Prepare device¶
You have to prepare your device for debugging. For Android 4.2+
tap Build number seven times:
Developer options appears now:
See also
Note
On practice instructions may differ for different devices. E.g. it may be
Android versionorMIUI versioninstead ofBuild number(http://en.miui.com/thread-24025-1-1.html)
Go to Developer options and turn it ON:
Also turn ON debug mode when USB is connected. Otherwise adb will not
be able to discover the device:
4.2.1.2. Get Android NDK¶
Polly
Script install-ci-dependencies.py will install Android NDK if environment variable
TOOLCHAINset toandroid-*.
Android NDK contains compilers and other tools for C++ development.
4.2.1.3. Get Android SDK¶
Android SDK tools used for development on Android platform: adb, android, emulator, etc.
4.2.1.4. Verify¶
Connect device with USB and verify it’s visible by adb service:
> adb devices
List of devices attached
MTPxxx device
If service is not started there will be extra messages:
> adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
MTPxxx device
4.2.1.5. SDK version on device¶
The needed version of SDK can be get by reading ro.build.version.sdk:
> adb -d shell getprop ro.build.version.sdk
19
Means you need to use API 19.
Note
-dis for real device-eis for emulator
4.2.1.6. CPU architecture¶
Run next command to determine CPU architecture of emulator:
> adb -e shell getprop ro.product.cpu.abi
x86
And this one for device:
> adb -d shell getprop ro.product.cpu.abi
armeabi-v7a
4.2.1.7. Log¶
See also
Clear log:
> adb logcat -c
Filter only Info (I) messages from SimpleApp, ignore others and exit:
> adb logcat -d SimpleApp:I '*:S'
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
I/SimpleApp( 9015): Hello from Android! (Not debug)
>
Any messages from SimpleApp, ignore others:
> adb logcat -d 'SimpleApp:*' '*:S'
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
I/SimpleApp( 9015): Hello from Android! (Not debug)
>