All notes

AVD, Emulators

AVD: Android Virtual Device image.

# List all:
emulator -list-avds
# Run one emulator
emulator -avd Nexus_5X_API_25_x86

react-native run-android
adb devices


Please ensure Intel HAXM is properly installed and usable

SO: haxm not installed.

# You may use find:
find / -iname "*intelhaxm*"

open ./Users/me/Library/Android/sdk/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM_6.0.5.dmg

Intel® Hardware Accelerated Execution Manager (Intel® HAXM) is a hardware-assisted virtualization engine (hypervisor) that uses Intel® Virtualization Technology (Intel® VT) to speed up Android* app emulation on a host machine. HAXM.

How to bring up the dev menu

SO: how to bring up the dev menu.

'Ctrl + m' works for Windows. Fn + F2 or "CMD+m" on OSX.

Or use: adb shell input keyevent 82.


Sign your app app signing.

# Generate a private key using keytool.
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias
# Note: keytool is located in the bin/ directory in your JDK. To locate your JDK from Android Studio, select File - Project Structure - click SDK Location and you will see the JDK location.
# It then generates the keystore as a file called my-release-key.jks, saving it in the current directory (you can move it wherever you'd like). The keystore contains a single key that is valid for 10,000 days.

# This creates an APK named module_name-unsigned.apk in project_name/module_name/build/outputs/apk/.
gradlew assembleRelease

# Align the unsigned APK using zipalign:
# zipalign ensures that all uncompressed data starts with a particular byte alignment relative to the start of the file, which may reduce the amount of RAM consumed by an app.
zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk

# Sign it!
apksigner sign --ks my-release-key.jks --out my-app-release.apk my-app-unsigned-aligned.apk

# Verify that your APK is signed:
apksigner verify my-app-release.apk

Configure Gradle to sign your APK

Open the module-level build.gradle file (wcfNote: e.g. the "app/build.gradle", not the one in upper project root directory) and add the signingConfigs {} block with entries for storeFile, storePassword, keyAlias and keyPassword, and then pass that object to the signingConfig property in your build type.

Because Gradle reads paths relative to the build.gradle, the example works only if my-release-key.jks is in the same directory as the build.gradle file.

android {
    defaultConfig { ... }
    signingConfigs {
        release {
            storeFile file("my-release-key.jks")
            storePassword "password"
            keyAlias "my-alias"
            keyPassword "password"
    buildTypes {
        release {
            signingConfig signingConfigs.release