New level API 31

Hello, I am trying to build my application with API level 31, which is already required by the Play Store and I am finding it impossible.

In theory I need cordova-android11 but there is no way to update this on my Meteor. I have it updated to 2.8, I have deleted cordova-android but I always end up running cordova-android@10.1.2.

Can anyone shed some light on this topic for me?

Thank you very much

Hi. I also had a few issues with this. Could solve it in a bit hacky way. Cf. Building Cordova Android SDK 31 target with FCM push support

@luvelnet

Hey, was able to build for API level 31 using these steps:

  • Build using API level 30 App.setPreference("android-targetSdkVersion", "30") in mobile-config.json
  • Update to use API level 31 in Android Studio
  • Add android:exported="true" to AndroidManifest.xml to all parents of intent-filter tag
  • Update com.google.gms:google-services to com.google.gms:google-services:4.3.14
  • In android/project/app/src/main/java/com/adobe/phonegap/push/FCMService.java
    • Update 1: PendingIntent contentIntent = PendingIntent.getActivity(this, requestCode, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); => PendingIntent contentIntent = PendingIntent.getActivity(this, requestCode, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT|PendingIntent.FLAG_IMMUTABLE);
    • Update 2: PendingIntent deleteIntent = PendingIntent.getBroadcast(this, requestCode, dismissedNotificationIntent, PendingIntent.FLAG_CANCEL_CURRENT); => PendingIntent deleteIntent = PendingIntent.getBroadcast(this, requestCode, dismissedNotificationIntent, PendingIntent.FLAG_CANCEL_CURRENT|PendingIntent.FLAG_IMMUTABLE);

Thank you for your answers. Finally I managed to upload the APP with API 31, as soon as I have a while I will post the steps that led me to do it.

Good day!

1 Like

Please do! It will help a lot of us!

Hi guys:

The steps to be able to upload the API in meteor (compilation from Windows), which worked for me, have been the following:

  1. Install Java 11.

  2. Install from Android Studio “cmdline-tools” and to avoid errors, add in Path (just before the logs for %ANDROID_HOME%\sdk\tools and \sdk\platform-tools):
    %ANDROID_HOME%\cmdline-tools\latest\bin
    These are the binaries we just installed.

  3. Finally add in the mobile-config.js:

   App.appendToConfig('<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity" xmlns:android="http://schemas.android. com/apk/res/android"><activity android:exported="true"></activity></edit-config>');
   App.setPreference('android-targetSdkVersion', '31');

I hope this can help someone.