breautek commented 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.
   
   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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to