| Dec | JAN | Feb |
| 02 | ||
| 2021 | 2022 | 2023 |
COLLECTED BY
Collection: Media Cloud
By default, the latest stable SDK Platform is installed, which includes a collection of packages required to target that version of Android.
To install system images and other minor SDK platform packages, you may need to ensure Show Package Details is checked at the bottom of the SDK Manager.
For future reference, the Android SDK can be managed with Android Studio in the Configure » SDK Manager menu of the Android Studio welcome screen or Tools » SDK Manager inside Android projects.
~/.bashrc, ~/.bash_profile, or similar shell startup scripts, make the following modifications:
Set the ANDROID_SDK_ROOT environment variable. This path should be the Android SDK Location used in the previous section.
$ export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
Add the Android SDK command-line directories to PATH. Each directory corresponds to the category of command-line tool.
$ # avdmanager, sdkmanager
$ export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
$ # adb, logcat
$ export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
$ # emulator
$ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
apksigner and zipalign, $ANDROID_SDK_ROOT/build-tools<version> must also be added to PATH.
Click Create Virtual Device and select a suitable device definition. If unsure, choose Pixel 2. Then, select a suitable system image. If unsure, choose Pie (API 28) with Google Play services. See Android version history for information on Android versions.
Once the AVD is created, launch the AVD into the Android emulator. Keeping the emulator running is the best way to ensure detection while developing Ionic apps for Android.
$ adb devices
The device should be listed. See the full adb documentation for troubleshooting and detailed information.
$ ionic capacitor add android
For Cordova, run the following:
$ ionic cordova prepare android
Set the Package ID.
For Capacitor, open the capacitor.config.json file and modify the appId property.
For Cordova, open the config.xml file and modify the idattribute of the root element, <widget>. See the Cordova documentation for more information.
$ ionic capacitor copy android
In Android Studio, click the Run button and then select the target simulator or device.
$ ionic capacitor run android -l --host=YOUR_IP_ADDRESS
When running on a device make sure the device and your development machine are connected to the same network.
ionic serve, to provide live-reload functionality.
Run the following to start a long-running CLI process that boots up a live-reload server:
$ ionic cordova run android -l
Now, when changes are made to the app's source files, web assets are rebuilt and the changes are reflected on the simulator or device without having to deploy again.
chrome://inspect in Chrome while the simulator is running or a device is connected to the computer and Inspect the app that needs to be debugged.
You can also access Logcat with ADB.
$ adb logcat
Edit this page
Previous
« Developing for iOS
Next
Development Tips »