Ionic, Cordova, Android

TheĀ Ionic docs describing development on Android are a bit out of date.
These steps worked for me on Windows 10.
  1. Assuming Java, JDK, and Ant are installed with `ANT_HOME` set to the directory containing `bin/ant`, and `JAVA_HOME` is set.
  2. Install Android Studio.
  3. Run Android Studio, select the `Configure` drop down, select `SDK Manager`, use it to install the relevant SDK (1.7.1 for me) and the `Android API`.
  4. Copy the `Android SDK Location` displayed at the top of the that Stuio window (eg `C:\Users\$username\AppData\Local\Android\Sdk`) into the env var `ANDROID_SDK`.
  5. Add to `PATH` the values `$ANDROID_SDK/tools` and `$ANDROID_SDK/platform-tools`.
  6. Sset mobile to Debugging mode (`Settings` > `About Phone`, and tap `Build number` seven times). Turn on `USB Debugging`.
  7. Connect phone to PC via USB. Grant access rights and install Windows drivers for the mobile phone when prompted/donwload drivers from vendor’s site.
  8. On PC, run `adb devices` and check the mobile is listed, if not visit SO.
  9. Finally, launch the app with one of these methods:
    1. In MS VSC, add `Cordova Tools` and add debug targets in `launch.json`
    2. ionic cordova run android --livereload

Common problems seem to be:

  • not having driver software on the PC — it often goes by the name of a ‘bridge’ or ‘connectivity’
  • ‘phone USB connection being in ‘charge’ mode rather than ‘media connection’ mode