This guide will help set up your development environment for building Cordova apps for Android devices and optionally use Android-specific command-line tools within your development workflow.
You will need to install and set up the requirements regardless of whether you want to use the Android-specific command-line tools or Cordova CLI commands.
Android API Level Support
The supported [versions of Android] corresponding with the Cordova-Android released versions are listed in the table below:
cordova-android Version Supported Android API-Levels Equivalent Android Version 11.X.X 22 - 32 5.1 - 12.0.0 [L] 10.X.X 22 - 30 5.1 - 11.0.0 9.X.X 22 - 29 5.1 - 10.0.0 8.X.X 19 - 28 4.4 - 9.0.0 7.X.X 19 - 27 4.4 - 8.1 6.X.X 16 - 26 4.1 - 8.0.0 5.X.X 14 - 23 4.0 - 6.0.1 4.1.X 14 - 22 4.0 - 5.1 4.0.X 10 - 22 2.3.3 - 5.1 3.7.X 10 - 21 2.3.3 - 5.0.2
Note: The cordova-android versions listed above are not for the Cordova CLI.
To determine what version of the Cordova-Android package is installed in your Cordova project, run the command
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
7 in your project's root directory.
As a general rule, Android versions become unsupported by Cordova as they dip below 5% on Google's distribution dashboard.
System Requirements
Cordova-Android requires the Android SDK, which can be installed on either macOS, Linux, or Windows.
For the base system requirements, see the Android Studio's .
The Required Software & Tools
Java Development Kit [JDK]
If you are using
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
8 10.0.0 or greater, install the Java Development Kit [JDK] 11.
If you are using any version below
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
8 10.0.0, install the Java Development Kit [JDK] 8.
The
C:\Users\[your user]\AppData\Local\Android\Sdk\platform-tools
C:\Users\[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
C:\Users\[your user]\AppData\Local\Android\Sdk\tools\emulator
0 environment variable must be set according to your JDK installation path. See the section on how to set up environment variables. Alternatively as of
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
8 10.0.0 or greater,
C:\Users\[your user]\AppData\Local\Android\Sdk\platform-tools
C:\Users\[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
C:\Users\[your user]\AppData\Local\Android\Sdk\tools\emulator
2 can be set in place of
C:\Users\[your user]\AppData\Local\Android\Sdk\platform-tools
C:\Users\[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
C:\Users\[your user]\AppData\Local\Android\Sdk\tools\emulator
0, allowing a JDK install to be used specifically for Cordova development.
Gradle
As of Cordova-Android 6.4.0, Gradle is required to be installed.
When installing on Windows, you need to add the path to the Gradle's binary directory to your
C:\Users\[your user]\AppData\Local\Android\Sdk\platform-tools
C:\Users\[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
C:\Users\[your user]\AppData\Local\Android\Sdk\tools\emulator
4 environment variable. See ] on how to configure system environment variables.
Note: This is the system's Gradle version. The system's Gradle binary will create the Gradle Wrapper file that declares and obtains the appropriate version of Gradle needed for building the Android application. The system-level and project-level version of Gradle may not and does not need to match. The project-level's version of Gradle is defined in the Cordova-Android's package and set based on what Android supports.
Android Studio
Download and install Android Studio. Follow the instructions at the linked Android Developer site to get started.
Opening Android Studio for the first time will guide you through the process of installing the Android SDK packages.
Adding SDK Packages
It is recommended to install the highest supported version of the SDK Platform and Build Tools based on the project's installed version of Cordova-Android. Please see the to find the supported version based on the Cordova-Android versions.
In the Android Studio, open the SDK Manager [
C:\Users\[your user]\AppData\Local\Android\Sdk\platform-tools
C:\Users\[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
C:\Users\[your user]\AppData\Local\Android\Sdk\tools\emulator
- and confirm that the following are installed for the targeted version of Android.:
- Android's SDK Platform for your targeted API Level
- Android SDK Build-Tools under the SDK Tools tab, for the targeted version.
Android SDK Tools
In Android Studio 3.6 or later, the obsolete Android SDK Tools will need to be intalled. To do this:
- Open the Android Studio
- Open the SDK Manager [
5]C:\Users[your user]\AppData\Local\Android\Sdk\platform-tools C:\Users[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin C:\Users[your user]\AppData\Local\Android\Sdk\tools\emulator
- Navigate to the SDK Tools tab
- Uncheck
7C:\Users[your user]\AppData\Local\Android\Sdk\platform-tools C:\Users[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin C:\Users[your user]\AppData\Local\Android\Sdk\tools\emulator
- Check
8C:\Users[your user]\AppData\Local\Android\Sdk\platform-tools C:\Users[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin C:\Users[your user]\AppData\Local\Android\Sdk\tools\emulator
See Android's documentation on how to for more details.
Setting environment variables
Cordova's CLI requires specific environment variables so it can function correctly. If the environment variables are missing, the CLI will attempt to resolve the variable temporarily. If the missing variables fail to resolve, they must be set manually.
The following variables must be set:
0 - The environment variable to the location of your JDK installationC:\Users[your user]\AppData\Local\Android\Sdk\platform-tools C:\Users[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin C:\Users[your user]\AppData\Local\Android\Sdk\tools\emulator
0 - The environment variable to the location of your Android SDK installationexport ORG_GRADLE_PROJECT_cdvMinSdkVersion=20 cordova build android
It is also recommended to update the
export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20
cordova build android
1 environment variable to include the following directories.
2export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20 cordova build android
3export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20 cordova build android
4export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20 cordova build android
export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20 cordova build android
5
- This is required for the
export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20 cordova build android
6 and
7 tools.export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20 cordova build android
- This is required for the
Note: The directories above are generally located in the Android SDK ROOT.
macOS and Linux
On a Mac or Linux, with a text editor, create or modify the
export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20
cordova build android
8 file.
To set an environment variable, add a line that uses
export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20
cordova build android
9 like so [substitute the path with your local installation]:
export ANDROID_SDK_ROOT=/Development/android-sdk/
To update your
export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20
cordova build android
1, add a line resembling the following [substitute the paths with your local Android SDK installation's location]:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
Reload your terminal to see this change reflected or run the following command:
Windows
These steps may vary depending on your installed version of Windows. Close and reopen any command prompt windows after making changes to see them reflected.
- Click on the Start menu or Press on the Windows Key [Win]
- Type in the search bar
1cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
- Select Edit the system environment variables options
- Click on the Environment Variables… button in the window that appears.
- Click on the New… button
- Type in the Variable name
- Type in the Variable value
- Click on the OK button
- Select PATH from the liste of already defined variable
- Click on the Edit… button
- Click on the New button
- Type in the relevant location.
Repeat step 3 and 4 until all paths are added.
Example paths [substitute the paths with your local Android SDK installation's location]:
C:\Users\[your user]\AppData\Local\Android\Sdk\platform-tools
C:\Users\[your user]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
C:\Users\[your user]\AppData\Local\Android\Sdk\tools\emulator
Once all paths are added, click the OK button until all opened windows for setting & editing environment variables are closed.
Project Configuration
Setting up an Emulator
If you wish to run your Cordova app on an Android emulator, you will first need to create an Android Virtual Device [AVD].
See the following Android documentation for more details on:
- Create and manage virtual devices
- Configure hardware acceleration for the Android Emulator.
Once your AVD is configured correctly, you should be able to deploy your Cordova application to the emulator by running the following command:
Configuring Gradle
Cordova-Android projects are built by using Gradle.
Setting Gradle Properties
It is possible to configure the Gradle build by setting the values of certain Gradle properties that Cordova exposes.
The following properties are available:
Property Description
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
2 Sets the version of the
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
3 library.
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
4 Sets the version of the
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
5 library.
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
6 Overrides the build architecture of which the app is built for. The default value is automatically detected by Cordova's build script.
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
7 If this is set, then multiple APK files will be generated: One per native platform supported by library projects [x86, ARM, etc]. This can be important if your project uses large native libraries, which can drastically increase the size of the generated APK. If not set, then a single APK will be generated which can be used on all devices
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
8 Overrides the automatically detected
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
9 value
ext.cdvMinSdkVersion = 20
0 Sets the SDK version of the framework which the app is been compiled for. Setting will override the automatic detection of the
ext.cdvMinSdkVersion = 20
1 value.
ext.cdvMinSdkVersion = 20
2 Default:
ext.cdvMinSdkVersion = 20
3 Path to a .properties file that contains signing information for debug builds [see ]. Useful when you need to share a signing key with other developers
ext.cdvMinSdkVersion = 20
4 set the maximum API Level which the application can run on
ext.cdvMinSdkVersion = 20
5 Overrides the value of
ext.cdvMinSdkVersion = 20
6 set in
ext.cdvMinSdkVersion = 20
7. Useful when creating multiple APKs based on SDK version
ext.cdvMinSdkVersion = 20
8 Default:
ext.cdvMinSdkVersion = 20
9 Path to a .properties file that contains signing information for release builds [see ]
// Example build-extras.gradle
// This file is included at the beginning of `build.gradle`
// special properties [see `build.gradle`] can be set and overwrite the defaults
ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
// normal `build.gradle` configuration can happen
android {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
// When set, this function `ext.postBuildExtras` allows code to run at the end of `build.gradle`
ext.postBuildExtras = {
android.buildTypes.debug.applicationIdSuffix = '.debug'
}
0 Overrides the
// Example build-extras.gradle
// This file is included at the beginning of `build.gradle`
// special properties [see `build.gradle`] can be set and overwrite the defaults
ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
// normal `build.gradle` configuration can happen
android {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
// When set, this function `ext.postBuildExtras` allows code to run at the end of `build.gradle`
ext.postBuildExtras = {
android.buildTypes.debug.applicationIdSuffix = '.debug'
}
1 value.
// Example build-extras.gradle
// This file is included at the beginning of `build.gradle`
// special properties [see `build.gradle`] can be set and overwrite the defaults
ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
// normal `build.gradle` configuration can happen
android {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
// When set, this function `ext.postBuildExtras` allows code to run at the end of `build.gradle`
ext.postBuildExtras = {
android.buildTypes.debug.applicationIdSuffix = '.debug'
}
2 Overrides the versionCode set in
ext.cdvMinSdkVersion = 20
7
// Example build-extras.gradle
// This file is included at the beginning of `build.gradle`
// special properties [see `build.gradle`] can be set and overwrite the defaults
ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
// normal `build.gradle` configuration can happen
android {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
// When set, this function `ext.postBuildExtras` allows code to run at the end of `build.gradle`
ext.postBuildExtras = {
android.buildTypes.debug.applicationIdSuffix = '.debug'
}
4 Whether to append a 0 "abi digit" to versionCode when only a single APK is build.
You can set these properties in one of four ways:
- Using an Environment Variables:
Example:
export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20 cordova build android
- Using the
// Example build-extras.gradle // This file is included at the beginning of `build.gradle
// special properties [seebuild.gradle
] can be set and overwrite the defaults ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties' // normalbuild.gradle
configuration can happen android { defaultConfig {
} } dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
} } // When set, this functionexclude group: 'com.android.support', module: 'support-annotations'
ext.postBuildExtras
allows code to run at the end ofbuild.gradle
ext.postBuildExtras = {
} `android.buildTypes.debug.applicationIdSuffix = '.debug'
5 flag with the Cordova
// Example build-extras.gradle // This file is included at the beginning of `build.gradle
// special properties [seebuild.gradle
] can be set and overwrite the defaults ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties' // normalbuild.gradle
configuration can happen android { defaultConfig {
} } dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
} } // When set, this functionexclude group: 'com.android.support', module: 'support-annotations'
ext.postBuildExtras
allows code to run at the end ofbuild.gradle
ext.postBuildExtras = {
} `android.buildTypes.debug.applicationIdSuffix = '.debug'
6 or
// Example build-extras.gradle // This file is included at the beginning of `build.gradle
// special properties [seebuild.gradle
] can be set and overwrite the defaults ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties' // normalbuild.gradle
configuration can happen android { defaultConfig {
} } dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
} } // When set, this functionexclude group: 'com.android.support', module: 'support-annotations'
ext.postBuildExtras
allows code to run at the end ofbuild.gradle
ext.postBuildExtras = {
} `android.buildTypes.debug.applicationIdSuffix = '.debug'
7 command: Example:
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
- Creating a
// Example build-extras.gradle // This file is included at the beginning of `build.gradle
// special properties [seebuild.gradle
] can be set and overwrite the defaults ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties' // normalbuild.gradle
configuration can happen android { defaultConfig {
} } dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
} } // When set, this functionexclude group: 'com.android.support', module: 'support-annotations'
ext.postBuildExtras
allows code to run at the end ofbuild.gradle
ext.postBuildExtras = {
} `android.buildTypes.debug.applicationIdSuffix = '.debug'
8 in the project's Android platform directory Create a file named
// Example build-extras.gradle // This file is included at the beginning of `build.gradle
// special properties [seebuild.gradle
] can be set and overwrite the defaults ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties' // normalbuild.gradle
configuration can happen android { defaultConfig {
} } dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
} } // When set, this functionexclude group: 'com.android.support', module: 'support-annotations'
ext.postBuildExtras
allows code to run at the end ofbuild.gradle
ext.postBuildExtras = {
} `android.buildTypes.debug.applicationIdSuffix = '.debug'
8 in the directory
0 with the contents such as: Example File Contents: - with the `build-extras.gradle file
Create a file named
2 in the directory
3 with the contents such as:
ext.cdvMinSdkVersion = 20
The latter two options both involve including an extra file in your Android platform folder. In general, it is discouraged to edit the contents of this folder because it is easy for those changes to be lost or overwritten. Instead, these files should be copied into the folder as part of the build command by using the
4 hook script.
Extending build.gradle
If you need to customize the
1 file, rather than edit it directly, it is recommended to create a sibling file named
2. This file will be included by the main
1 script when present. This file must be placed in the
8 folder of the Android's platform directory [
9]. It is recommended to use the
4 hook script to copy this file over.
Here's an example:
// Example build-extras.gradle
// This file is included at the beginning of `build.gradle`
// special properties [see `build.gradle`] can be set and overwrite the defaults
ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
// normal `build.gradle` configuration can happen
android {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
// When set, this function `ext.postBuildExtras` allows code to run at the end of `build.gradle`
ext.postBuildExtras = {
android.buildTypes.debug.applicationIdSuffix = '.debug'
}
Note that plugins can also include
2 files via:
Configuring Gradle JVM Args
To change the Gradle JVM args, the
cordova build android -- --jvmargs='-Xmx4g'
2 flag can be used with both Cordova's
// Example build-extras.gradle
// This file is included at the beginning of `build.gradle`
// special properties [see `build.gradle`] can be set and overwrite the defaults
ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
// normal `build.gradle` configuration can happen
android {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
// When set, this function `ext.postBuildExtras` allows code to run at the end of `build.gradle`
ext.postBuildExtras = {
android.buildTypes.debug.applicationIdSuffix = '.debug'
}
6 and
// Example build-extras.gradle
// This file is included at the beginning of `build.gradle`
// special properties [see `build.gradle`] can be set and overwrite the defaults
ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
// normal `build.gradle` configuration can happen
android {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
// When set, this function `ext.postBuildExtras` allows code to run at the end of `build.gradle`
ext.postBuildExtras = {
android.buildTypes.debug.applicationIdSuffix = '.debug'
}
7 commands. This is mostly useful for controlling how much memory gradle is allowed to use during the build process. It is recommended to allow at least 2048 MB.
By default, JVM args has a value of
cordova build android -- --jvmargs='-Xmx4g'
5. To increase the maximum allowed memory, use the
cordova build android -- --jvmargs='-Xmx4g'
6 JVM arg. Example given below:
cordova build android -- --jvmargs='-Xmx4g'
The following units are supported:
unit value example kilobyte k
cordova build android -- --jvmargs='-Xmx4g'
7 megabyte m
cordova build android -- --jvmargs='-Xmx4g'
5 gigabyte g
cordova build android -- --jvmargs='-Xmx4g'
9
Setting the Version Code
To change the version code for your app's generated apk, set the
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
0 attribute in the
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
1 element of your application's config.xml file.
If the
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
0 is not set, the version code will be determined using the
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
3 attribute. For example, if the version is
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
4:
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
If your application has enabled the
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
7 Gradle property [see ], the version code of your app will also be multiplied by 10 so that the last digit of the code can be used to indicate the architecture the apk was built for. This multiplication will happen regardless of whether the version code is taken from the
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
0 attribute or generated using the
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
3.
Note: Be aware that some plugins added to your project may set this Gradle property automatically.
Note: When updating the
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
0 property, it is not recommended to increment the version code taken from built apks. It is recommended to increment the code based off the value in your
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
9 file's
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
0 attribute. This is because the
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
7 property causes the version code to be multiplied by 10 in the built apks and thus using that value will cause your next version code to be 100 times the original, etc.
Signing an App
It is recommended to read Android's documentation for Sign your app first, as it contains the necessary steps in creating required files for signing.
Using Flags
To sign an app, you need the following parameters:
Parameter Flag Description Keystore
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
02 Path to a binary file which can hold a set of keys Keystore Password
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
03 Password to the keystore Alias
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
04 The id specifying the private key used for signing Password
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
05 Password for the private key specified Type of the Keystore
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
06 Default: auto-detect based on file extension Either pkcs12 or jks Package Type
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
07 Default: apk for debug, bundle for release Specify whether to build an APK or an AAB [Android App Bundle] file. Acceptable Values:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
08 or
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
09
The parameters above can be specified as an argument when using the Cordova CLI
// Example build-extras.gradle
// This file is included at the beginning of `build.gradle`
// special properties [see `build.gradle`] can be set and overwrite the defaults
ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
// normal `build.gradle` configuration can happen
android {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
// When set, this function `ext.postBuildExtras` allows code to run at the end of `build.gradle`
ext.postBuildExtras = {
android.buildTypes.debug.applicationIdSuffix = '.debug'
}
6 or
// Example build-extras.gradle
// This file is included at the beginning of `build.gradle`
// special properties [see `build.gradle`] can be set and overwrite the defaults
ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
// normal `build.gradle` configuration can happen
android {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}
// When set, this function `ext.postBuildExtras` allows code to run at the end of `build.gradle`
ext.postBuildExtras = {
android.buildTypes.debug.applicationIdSuffix = '.debug'
}
7 commands.
Note: You should use double
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
12 to indicate that these are platform-specific arguments.
Example:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
13.
Using
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
14
Alternatively, you could specify the signing parameters in a build configuration file [
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
14].
By default, if the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
14 file exists in the project's root directory, it will automatically be detected and used. If the file is not located in the project's root directory or has multiple configuration files, the command line argument
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
17 must be supplied with the path to the file.
Example
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
14 configuration file:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
0
There is also support to mix and match command line arguments and parameters in
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
14. Values from the command line arguments takes precedence. This can be useful for specifying passwords on the command line.
Using Gradle
You can also specify signing properties by including a
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
20 file and pointing to it with the
ext.cdvMinSdkVersion = 20
8 and
ext.cdvMinSdkVersion = 20
2 Gradle properties [see ].
Example file content:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
1
The
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
23 and
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
24 properties are required for automated signing.
Debugging
For details on the debugging tools that come packaged with the Android SDK, see Android's developer documentation for debugging. Additionally, Android's developer documentation for debugging web apps provides an introduction for debugging the portion of your app running in the Webview.
Opening a Project in Android Studio
Cordova-Android projects can be opened in Android Studio. This can be useful if you wish to use Android Studio's built in Android debugging and profiling tools or if you are developing Android plugins.
Note: When opening your project in Android Studio, it is recommended to NOT edit the code within the IDE. Editing in Android Studio will edit code residing in the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
25 directory of your project. It is not updating the code in the projects root
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
26]directory. The changes are liable to be overwritten. Instead, edit the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
26 folder and copy over your changes by running
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
28.
Plugin developers wishing to edit their native code in Android Studio should use the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
29 flag when adding their plugin to the project with the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
30. This will create a symbolic link of the plugin files from the plugin source directory to the project's
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
25 directory.
To open a Cordova-Android project in Android Studio:
- Launch Android Studio
- Click the Open button
- Navigate to the project's Android platform directory: [
0] - For the
33 question you can simply answer Yes.export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
Once it finishes importing, you should be able to build and run the app directly from Android Studio.
For more resources, please see:
- Meet Android Studio
- Build and run your app
Upgrading
Refer to this article for instructions to upgrade your
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
8 version.
Lifecycle Guide
Cordova and Android
Native Android apps typically consist of a series of activities that the user interacts with. Activities can be thought of as the individual screens that make up an application; different tasks in an app will often have their own activity. Each activity has its own lifecycle that is maintained as the activity enters and leaves the foreground of a user's device.
In contrast, Cordova applications on the Android platform are executed within a Webview that is embedded in a single Android activity. The lifecycle of this activity is exposed to your application through the document events that are fired. The events are not guaranteed to line up with Android's lifecycle, but they can provide guidelines for saving and restoring your state. These events roughly map to Android callbacks as follows:
Cordova Event Rough Android Equivalent Meaning
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
35
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
36 Application is starting [not from background]
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
37
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
38 Application is moving to the background
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
39
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
40 Application is returning to the foreground
Most other Cordova platforms have a similar concept of lifecycles and should fire these same events when similar actions happen on a user's device. However, Android presents some unique challenges that can sometimes show up thanks to the native Activity lifecycle.
What makes Android different?
In Android, the OS can choose to kill activities in the background in order to free up resources if the device is low on memory. Unfortunately, when the activity holding your application is killed, the Webview in which your application lives will be destroyed as well. Any state that your application is maintaining will be lost in this case. When the user navigates back to your application, the Activity and Webview will be recreated by the OS, but state will not be automatically restored for your Cordova app. For this reason, it is imperative that your application be aware of the lifecycle events that are fired and maintain whatever state is appropriate to make sure a user's context in your app is not lost when they leave the application.
When can this happen?
Your application is susceptible to being destroyed by the OS whenever it leaves the sight of the user. There are two main situations in which this can occur. The first and most obvious case is when the user presses the home button or switches to another application.
However, there is a second [and much more subtle] case that certain plugins can introduce. As noted above, Cordova applications are usually confined to the single activity that contains the Webview. However, there are instances in which other activities may be launched by plugins and temporarily push the Cordova activity to the background. These other Activities are typically launched in order to perform a specific task using a native application installed on the device. For example, the Cordova camera plugin launches whatever camera activity is natively installed on the device in order to take a photo. Reusing the installed camera application in this way makes your application feel much more like a native app when the user tries to take a photo. Unfortunately, when the native Activity pushes your app to the background there is a chance the OS will kill it.
For a clearer understanding of this second case, let's walk through an example using the camera plugin. Imagine you have an application that requires the user to take a profile photo. The flow of events in the application when everything goes as planned will look something like this:
- The user is interacting with your app and needs to take a picture
- The camera plugin launches the native camera activity
- The Cordova activity is pushed to the background [pause event is fired]
- The user takes a photo
- The camera activity finishes
- The Cordova activity is moved to the foreground [resume event is fired]
- The user is returned to your application where they left off
However, this flow of events can be disrupted if a device is low on memory. If the Activity is killed by the OS, the above sequence of events instead plays out as follows:
- The user is interacting with your app and needs to take a picture
- The camera plugin launches the native camera activity
- The OS destroys the Cordova activity [pause event is fired]
- The user takes a photo
- The camera activity finishes
- The OS recreates the Cordova activity [deviceready and resume events are fired]
- The user is confused as to why they are suddenly back at your app's login screen
In this instance, the OS killed the application in the background and the application did not maintain its state as part of the lifecycle. When the user returned to the app, the Webview was recreated and the app appeared to have restarted from scratch [hence the user's confusion]. This sequence of events is equivalent to what happens when the home button is pressed or the user switches applications. The key to preventing the above experience is subscribing to events and properly maintaining state as part of the activity lifecycle.
Respecting the Lifecycle
In the examples above, the javascript events that are fired are noted in italics. These events are your opportunity to save and restore your application's state. You should register callbacks in your application's
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
41 function that respond to the lifecycle events by saving state. What information you save and how you save it is left to your discretion, but you should be sure to save enough information so that you can restore the user to exactly where they left off when they return to your application.
There is one additional factor in the example above that only applies in the second-discussed situation [i.e. when a plugin launches an external activity]. Not only was the state of the application lost when the user finished taking a photo, but so was the photo that the user took. Normally, that photo would be delivered to your application through the callback that was registered with the camera plugin. However, when the Webview was destroyed that callback was lost forever. Luckily, cordova-android 5.1.0 and above provide a means for getting the result of that plugin call when your application resumes.
Retrieving plugin callback results [cordova-android 5.1.0+]
When the OS destroys the Cordova activity that was pushed into the background by a plugin, any pending callbacks are lost as well. This means that if you passed a callback to the plugin that launched the new activity [e.g. the camera plugin], that callback will NOT be fired when the application is recreated. However, starting in cordova-android 5.1.0, the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
39 event's payload will contain any pending plugin results from the plugin request that launched the external activity made prior to the activity being destroyed.
The payload for the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
39 event adheres to the following format:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
2
The fields of that payload are defined as follows:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
44: The name of the plugin returning the result [e.g. "Camera"]. This can be found in the
45 tag of a plugin's plugin.xml fileexport PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
46: The status of the plugin call [see below]export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
47: Whatever the result of the plugin call isexport PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
The possible values for
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
46 in the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
49 field include the following:
50 - The plugin call was successfulexport PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
51 - The plugin call ended with no resultexport PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
52 - The plugin call resulted in some general errorexport PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
- Other miscellaneous errors
53export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
54export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
55export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
56export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
57export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
58export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
59export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/ export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
Note: It is up to the plugin to decide what is contained in the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
47 field and the meaning of the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
46 that is returned. Refer to the plugin's API documentationf or the expect results and how to use the values.
Example
Below is a brief example application that uses the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
39 and
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
37 events to manage state. It uses the Apache camera plugin as an example of how to retrieve the results of a plugin call from the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
39 event payload. The portion of the code dealing with the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
39's
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
66 object requires cordova-android 5.1.0+
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
3
The corresponding html:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
4
Android Quirks
The default API level in the Cordova-Android platform has been upgraded. On an Android 9 device, clear text communication is now disabled by default.
By default HTTP and FTP etc. will refuse the apps requests to use cleartext traffic. The key reason for avoiding cleartext traffic is the lack of confidentiality, authenticity, and protections against tampering; a network attacker can eavesdrop on transmitted data and also modify it without being detected. You can learn more about the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
67 or any other android application elements setting in the documentation for Android developers.
To allow clear text communication again, set the
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
67 on your application tag to true in
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
9 file:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
5
And also you need to add Android XML namespace
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
70 to your widget tag in the same
versionCode = MAJOR * 10000 + MINOR * 100 + PATCH
9.
Example:
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
6
Android Manifest Information
You can learn more about the Android manifest information in the documentation for Android developers.
Testing the Activity Lifecycle
Android provides a developer setting for testing Activity destruction on low memory. Enable the "Don't keep activities" setting in the Developer Options menu on your device or emulator to simulate low memory scenarios. You should always do some amount of testing with this setting enabled to make sure that your application is properly maintaining state.