how to get capacitor to use a different targetSdkVerion

47 Views Asked by At

The version of capacitor that I using in my node app is "^4.5.0".

When I run

npx cap build android

it will create the android directory, which will contain the variables.gradle file:

ext {
    minSdkVersion = 22
    compileSdkVersion = 32
    targetSdkVersion = 32
    androidxActivityVersion = '1.4.0'
    androidxAppCompatVersion = '1.4.2'
    androidxCoordinatorLayoutVersion = '1.2.0'
    androidxCoreVersion = '1.8.0'
    androidxFragmentVersion = '1.4.1'
    coreSplashScreenVersion = '1.0.0-rc01'
    androidxWebkitVersion = '1.4.0'
    junitVersion = '4.13.2'
    androidxJunitVersion = '1.1.3'
    androidxEspressoCoreVersion = '3.4.0'
    cordovaAndroidVersion = '10.1.1'
}

Google now requires the use of targetSdkVersion = 33.

For example, is there something that I add to the capacitor.config.ts file in order to accomplish this?

1

There are 1 best solutions below

0
Mukilan On

with the new Developer policies, Google Play requires all applications to be built for targetSDKVersion 33 to support Android 13 and + with API Level 33 or so, It is a mandatory requirement to change your targetSDKVersion to 33 to allow future updates via play store.

With that context: All you need to do is change targetSDKVersion = 33 from 32 in your variables.gradle file and rebuild and sync your application.

Now you are good to go for adding the bundles in play console. hope that helps. :)