Android 14, target SDK version 34

I’m working on submitting a new app to the Play store but getting this message:

Your app currently targets API level 33 and must target at least API level 34 to ensure it is built on the latest APIs optimized for security and performance.

Clicking Learn More takes me here: Learn More

That link says,

When you upload an APK, it must meet Google Play’s target API level requirements.

Starting August 31 2024:

New apps and app updates must target Android 14 (API level 34) or higher to be submitted to Google Play; except for Wear OS and Android TV apps, which must target Android 13 (API level 33) or higher

Today is July 4th, 2024, so I’m not sure why am I getting this message, but is there a way to target sdk version 34?

1 Like

@flint-mike

If you are using https://www.pwabuilder.com like me, there is a workaround at [PWA Builder]: Support for Android SDK 34 · Issue #4766 · pwa-builder/PWABuilder · GitHub

App.setPreference('android-targetSdkVersion', '34');

This is the way in Meteor-Cordova to achieve this I think, within the mobile-config.js file. This should be enough to see your android project in production to use the required version.

Otherwise, when building your android app for production, find the build.gradle file within the android project generated that contains targetSdkVersion and modify to targetSdkVersion 34. Rebuild your app, verify it works and re-upload in the store.

Has anybody tried creating Meteor Android app for sdkversion 34. For me it is giving error as it requires a higher gradle version and higher sdk version.
If anybody has successfully done it, can somebody share the mobile-config used please, also the gradle and sdk version

Looks like I was able to do a generation Couple of things I required

  1. update openjdk to 17.0.2
  2. update Android SDK to have 34/35
  3. update Android commandline tools
  4. add after_prepare hook to solve the duplicate permission issue problem
App.setPreference('android-targetSdkVersion', '34');
App.setPreference('android-minSdkVersion', '30');
App.setPreference("GradlePluginKotlinEnabled", true);
App.setPreference("GradlePluginKotlinVersion", "1.7.10");
App.addResourceFile ('hooks/after.js', 'hooks/after.js', 'android');
App.appendToConfig(`
  </platform>
  <platform name="android">
    <hook type="before_compile" src="../../local/cordova-build/platforms/android/hooks/after.js" />
     </platform>
  `);
  1. Override gradle by passing
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=https://services.gradle.org/distributions/gradle-8.9-all.ziptype or paste code here
1 Like