I am using cordova-android@6.1.2 (latest) and targeting Android. By default, Cordova selects the highest API level (i.e. 25) for compilation. That works. But the apk will not run on lower API-level on my Android emulator.
On the Cordava page (https://cordova.apache.org/docs/en/latest/guide/platforms/android/#setting-gradle-properties) is instruction on how to compile with lower API-level by setting the environment variable
$ export ORG_GRADLE_PROJECT_cdvCompileSdkVersion=19
I did that and the compile error is:
* What went wrong:
A problem occurred configuring root project âandroidâ.
java.lang.NullPointerException (no error message)â
Knowing that the highest API-level is 25, I set
$ export ORG_GRADLE_PROJECT_cdvCompileSdkVersion=25
but I get the same error. The only way to successfully compile through the libraries is to not set any environment variables.
I know I can use an older version of cordova-android by removing the Android platform and
ionic platform add android@4
but this only allows me to go down to API-level 22.
ionic platform add android@3.7
gets me API-level 21.
It looks to me like there is a way to target lower API-level with the latest Cordova release. What did I do wrong?
Ionic2 version is 2.2.1.
Cordova CLI version is 6.5.0.
Android SDK Tools 25.2.5.
Android SDK Platform-tools 25.0.3
Android SDK Build-tools 25.0.2
Build machine - macOS Sierra
keywords: cdvCompileSdkVersion, API-level