Android

🍱Framework
android
mobile
outdated

adb commands

View all running devices (virtual and real)

adb devices

Reboot virtual device

adb reboot

Check out contents of phone

adb shell

# cd /storage/self/primary/WhatsApp/Media/

WhatsApp

Copy WhatsApp images/videos/voice notes etc. from phone to local folder (-a: preserve file timestamp and mode). These commands copy the entire folder (with all of its files):

adb pull -a /storage/self/primary/WhatsApp/Media/WhatsApp\ Images/ .
adb pull -a /storage/self/primary/WhatsApp/Media/WhatsApp\ Video/ .
adb pull -a /storage/self/primary/WhatsApp/Media/WhatsApp\ Voice\ Notes/ .
adb pull -a /storage/self/primary/DCIM/Camera/ .

This is much more reliable then Android File Transfer

Save Whatsapp backups:

adb pull -a /storage/self/primary/WhatsApp/Databases

Track native Android errors

adb logcat | grep „MY_ERROR_CODE“

In Code, e.g. in MainActivity.java:

MainActivity.java
Log.i("Write debug text");

Android Development

Android API Guides

Build errors

Build App with Gradle

Gradle configuration

In file build.gradle and app/build.gradle

Product flavors

Copy settings for a flavor to the code base.

SDK manager

Start sdk manager

Either open a terminal and type

android

or open it from Android Studio.

My Android SDK location is now /usr/local/Cellar/android-sdk/ on the entire PC, including Android Studio.

In .bash_profile the right paths are set.

Emulators

  • Genymotion: A virtual machine is the emulator for Genymotion
  • An AVD (Android virtual device) with the fast google APIs is used as an emulator in Android Studio.

Headless mode

Discuss on TwitterImprove this article: Edit on GitHub

Discussion


Explain Programming

André Kovac builds products, creates software, teaches coding, communicates science and speaks at events.