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 to be set:
Property | Description |
---|---|
cdvBuildMultipleApks |
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 |
cdvVersionCode |
Overrides the versionCode set in AndroidManifest.xml
|
cdvReleaseSigningPropertiesFile |
Default: release-signing.properties |
Path to a .properties file that contains signing information for release builds (see Signing an App) | |
cdvDebugSigningPropertiesFile |
Default: debug-signing.properties |
Path to a .properties file that contains signing information for debug builds (see Signing an App). Useful when you need to share a signing key with other developers | |
cdvMinSdkVersion |
Overrides the value of minSdkVersion set in AndroidManifest.xml . Useful when creating multiple APKs based on SDK version |
cdvBuildToolsVersion |
Overrides the automatically detected android.buildToolsVersion value |
cdvCompileSdkVersion |
Overrides the automatically detected android.compileSdkVersion value |
You can set these properties in one of four ways:
-
By setting environment variables like so:
$ export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20 $ cordova build android
-
By using the
--gradleArg
flag in your Cordovabuild
orrun
commands:$ cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
-
By placing a file called
gradle.properties
in your Android platform folder (<your-project>/platforms/android
) and setting the properties in it like so:# In <your-project>/platforms/android/app/gradle.properties cdvMinSdkVersion=20
-
By extending
build.gradle
via abuild-extras.gradle
file and setting the property like so:// In <your-project>/platforms/android/app/build-extras.gradle ext.cdvMinSdkVersion = 20
网友评论