Your app is affected by Google Play's target API level requirements

My android app receieved an email from Google:

" Starting August 31, 2024 , new apps and app update submissions must target Android 14 (API level 34), except for Wear and TV OS apps, which must target Android 13 (API level 33) or higher. Existing apps must target Android 13 (API level 33) or higher to remain available to new users on devices running Android OS higher than your app’s target API level. To save time and effort, you can use the new SDK Upgrade Assistant in Android Studio. You will also be able to request an extension until November 1, 2024 if you need more time to update your app."

What do I do to fix this error and upload my app back to the play store?

You need to update to Capacitor 6 which uses API level 34.

3 Likes

Update your app to target Android 14 (API level 34). Use Android Studio’s SDK Upgrade Assistant, test your app, and re-upload it. Request an extension until November 1, 2024, if needed.

Cordova i am not able to update to sdk 34 i got error
I am trying to update target sdk version from 33 to 34.I Executed the command ionic cordova build android

My Environment:
ionic -v - 7.0.2
cordova- v - 12.0.0
node -v - v20.11.1
npm -v -10.8.1
gradle -v -Gradle 8.6
ng --version ’ or ’ ng version ’ or ’ ng v ’ -18.0.6

i got error like A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction

AAPT2 aapt2-4.2.2-7147631-windows Daemon #0: Unexpected error during link, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
while build app with target sdk 34

Update Cordova to v13 which supports SDK 34 - cordova-android/RELEASENOTES.md at 3503bfa31b10cc7d6948356d4c101c7b76109688 · apache/cordova-android · GitHub

2 Likes

I am updated to Ionic v8 and capacitor 6 using the migration guide. The targetSdkVersion is still 33 and causing an error when I upload a new release to the play store. Any guidance?

Can I manually bump the targetSdkVersion to 34 then run ionic cap sync android, and resubmit if I have followed all the steps in the migration guide you provided?

how did you update? manually or using npx cap migrate command?
If you used npx cap migrate, did you update @capacitor/cli to latest first?

I believe I did it manually several months ago following the guide.

Ok so I updated @capacitor/cli and ran npx cap migrate. It succeeded but the targetSdkVersion is still 33.

Are you sure you installed @capacitor/cli version 6?
can you share the log messages migrate command shows?

[info] Please note this tool is not intended for use in a mono-repo environment,
please check out the Ionic vscode extension for this functionality.
[?] Capacitor 6 sets a deployment target of iOS 13 and Android 14 (SDK 34).

:heavy_check_mark: Are you sure you want to migrate? (Y/n) … y
[?] Would you like the migrator to run npm, yarn, pnpm, or bun install to install
the latest versions of capacitor packages? (Those using other package managers
should answer N)
:heavy_check_mark: Run Dependency Install? (Y/n) … y
[?] What dependency manager do you use?
:heavy_check_mark: Dependency Management Tool › NPM
⠏ Installing Latest Modules using npm.
:heavy_check_mark: Installing Latest Modules using npm. in 112.09s
:heavy_check_mark: Migrating Info.plist by removing NSLocationAlwaysUsageDescription key. in 1.95ms
:heavy_check_mark: Running cap sync. in 9.24s
[warn] Skipped upgrading gradle wrapper files
[info] Set com.google.gms:google-services = 4.4.0.
:heavy_check_mark: Migrating build.gradle file. in 1.62ms
:heavy_check_mark: Replacing deprecated compileSdkVersion from build.gradle in 147.54μs
:heavy_check_mark: Migrating variables.gradle file. in 4.51ms
:heavy_check_mark: Migrating package from Manifest to build.gradle in Capacitor plugins in 43.72ms
[info] IMPORTANT: Review Updating to 6.0 | Capacitor Documentation
for breaking changes in these plugins that you use: @capacitor/camera,
@capacitor/filesystem, @capacitor/local-notifications.
:heavy_check_mark: Writing breaking changes. in 1.23ms
[success] Migration to Capacitor ^6.0.0 is complete. Run and test your app!

Hey Julio, were you able to review my console print off?

There are only one warning that can happen when some plugin is not updated for Capacitor 6, but it says it updated the variables.gradle successfully, so it should have updated the targetSdkVersion to 34, but you say it didn’t, so I don’t know what could have happened.

Does the targetSdkVersion declaration in the app’s build.gradle looks like this targetSdkVersion rootProject.ext.targetSdkVersion?
or in which files you see that targetSdkVersion was not updated?

This is my variables.gradle

ext {
    minSdkVersion = 22
    compileSdkVersion = 34
    targetSdkVersion = 34
    androidxActivityVersion = '1.8.0'
    androidxAppCompatVersion = '1.6.1'
    androidxCoordinatorLayoutVersion = '1.2.0'
    androidxCoreVersion = '1.12.0'
    androidxFragmentVersion = '1.6.2'
    junitVersion = '4.13.2'
    androidxJunitVersion = '1.1.5'
    androidxEspressoCoreVersion = '3.5.1'
    cordovaAndroidVersion = '10.1.1'
    coreSplashScreenVersion = '1.0.1'
    androidxWebkitVersion = '1.9.0'
}

But then the build.gradle targetSdkVersion never upgraded to 34. This is what it looks like:

android {
    namespace "com.encoded.example"
    compileSdkVersion 34
    defaultConfig {
        applicationId "com.encoded.mogastaxback"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion 33
        versionCode 62
        versionName '13.4.1'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        aaptOptions {
             // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
             // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
            ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

Yeah, the migration script only updates variables.gradle file.

In the apps build.gradle it should appear like this targetSdkVersion rootProject.ext.targetSdkVersion, so it picks the value from variables.gradle, but looks like you changed it to be 33, so you have to update it to 34 now, or back to targetSdkVersion rootProject.ext.targetSdkVersion so it gets the value from variables.gradle and gets automatically updated by npx cap migrate next time.

And you should also update the compileSdkVersion 34 to compileSdk rootProject.ext.compileSdkVersion

1 Like