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/03/24 07:10:04 UTC

[GitHub] [cordova-android] mobilemarines commented on issue #1006: [feature-request] change the default target sdk to (API Level 30)

mobilemarines commented on issue #1006:
URL: https://github.com/apache/cordova-android/issues/1006#issuecomment-805560346


   The preference
   `<preference name="android-targetSdkVersion" value="30" />`
   in the config.xml has no effect because
   `node_modules\cordova-android\bin\templates\project\build.gradle`
   sets
   `defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default`
   which will always overwrite your config.xml setting.
   The overwrite is done in
   `node_modules\cordova-android\bin\templates\project\app\build.gradle`
   ```
   // Set property defaults after extension .gradle files.
   ext.cdvCompileSdkVersion = cdvCompileSdkVersion == null ? (
       defaultCompileSdkVersion == null
           ? privateHelpers.getProjectTarget()
           : defaultCompileSdkVersion
   ) : Integer.parseInt('' + cdvCompileSdkVersion);
   ```
   
   As workaround you can modify your build-extra.gradle as follows:
   ```
   allprojects {
       // Overwrite Cordova fixed target SDK 29
       project.ext {
         defaultTargetSdkVersion=30
         defaultCompileSdkVersion=30
       }
   }
   ```
   
   When building your project there is still displayed **Android target: android-29** (which is not true).
   But when analyzing the APKs AndroidManifest.xml in Android Studio (Build/Analyze APK) you can see that
   platformBuildVersionCode="30" now.


-- 
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