You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/04/06 04:46:06 UTC

[GitHub] [cordova-android] breautek edited a comment on issue #1178: not working and keep asking for 29

breautek edited a comment on issue #1178:
URL: https://github.com/apache/cordova-android/issues/1178#issuecomment-813815686


   > Adding to the importance of resolving this issue is very soon Google store won't accept submission of [sdk level less than 30](https://developer.android.com/distribute/best-practices/develop/target-sdk).
   
   This is not related to this issue. Targeting API 30 still works via `android-targetSdkVersion` preference, so that's not a problem. Additionally we will bump our default target SDKs on our major releases to match the requirement of Google Play store.
   
   The issue described in this ticket is Cordova will still attempt to the default platform SDK (currently API 29) even when targetSdkVersion is set to a different API level. **So the current workaround is to simply have both platform 29 & 30 installed.** 
   
   I've had a chance to do some digging on the cause and I've found 3 things that Cordova tooling must do:
   
   ### (1) Ensure compileSdkVersion matches targetSdkVersion 
   
   `compileSdkVersion` is the SDK that the application is compiled against, while the `targetSdkVersion` is an assertion that you've tested your application at the target SDK level for compatibility. If the platform API level is higher of the target, then the platform will enable backwards-compatibility behaviours.
   
   There isn't any real reason to have a `compileSdkVersion` set that is different than the `targetSdkVersion` and doing so can cause an unstable application. Currently, the `android-targetSdkVersion` overrides but doesn't modify `compileSdkVersion` creating this possibility. Cordova should force `compileSdkVersion` and `targetSdkVersion` to be equal.
   
   There is currently no `config.xml` preference to set the `compileSdkVersion`, and the lack of this feature should remain. There is a [cdvCompileSdkVersion](https://cordova.apache.org/docs/en/10.x/guide/platforms/android/index.html#setting-gradle-properties) cordova gradle flag, which I think should become deprecated and potentially removed in `cordova-android@10` and replaced with a `cdvTargetSdkVersion` flag to match the `config.xml`'s `android-targetSdkVersion` preference.
   
   ### (2) Ensure android/project.properties has the correct target
   
   Currently, Cordova does not modify the `target` attribute inside `/platforms/android/project.properties` and it remains set to `android-29` which will cause the Android Gradle Plugin (AGP) to download Platform 29.
   
   ### (3) Ensure android/CordovaLib/project.properties has the correct target
   
   Currently, Cordova does not modify the `target` attribute inside `/platforms/android/CordovaLib/project.properties` and it remains set to `android-29` which will cause AGP to download Platform 29.
   
   Additionally, a warning should be printed for when the SDK is overridden and uses a value other than the Cordova default target SDK, similar to the min sdk override warning. Using an alternate SDK level is not really a supported feature, so this preference is more-or-less "use at your own risk" (and really should be documented as such).
   
   All 3 actions must be done in order for the AGP to not download API 29.
   
   ICYMI: You can workaround this issue by installing both Platform 29 & 30. You can still build APKs targeted against API 30.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org