Mobile-config compatibility for android 12

ive built a meteor cordova app that runs very well on my android 11. but it wont run on android 12 (crashes without opening at all)

im a newbee to android development (config.xml n manifest etc is all unknown) so ive this mobile-config file

// Add custom tags for a particular PhoneGap/Cordova plugin to the end of the
// generated config.xml. 'Universal Links' is shown as an example here.
App.appendToConfig(`
<platform name="android">
    <preference name="android-targetSdkVersion" value="31" />
    <preference name="android-minSdkVersion" value="24" />
    <activity android:name=".otherActivity" android:exported="true"/> </platform>

`);
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"/>
  </edit-config>`);

any help from experts on any obvious mistakes or any links to such tutorials will help me a lot. Many thanks!

1 Like

@digisarathi Hello! What errors do you get on the console?

Besides setting the exported flag (as you already did), you also need to ensure that the Java version that meteor uses to build the app is at least 11 and update your cmdline-tools version to the latest one.

hello!
i have this java version
Screenshot 2022-09-23 at 5.58.34 PM

ive now upgraded cmdline-tools to latest (7.0) it was 6.0 before.

I don’t get any specific errors on console (dot log you mean?) I’ve android 11 and it works fine there. on my friend’s android 12, it doesn’t start at all. it just says ‘App crashed too many times’

I’m trying to get my hands on an android 12 to debug further and get back here with more details.
many thanks for your support!
kind regards.


The friend sent this screenshot of his one plus Android 12.
Any clues for me to try would be very helpful. Many thanks!

@digisarathi This seems like a plugin issue, probably you have a plugin that isn’t compatible with the newest android API. What’s your cordova-plugins file? One way to go here would be to remove one by one and check if the error still occurs. If you find the broken plugin, you will need to create an issue on the respective repository or fix it with a fork.

1 Like

Right matheusccastro, you shared such a useful informain.

Hey! thanks so much. so I use only one plugin cordova-plugin-admob. it is the latest version 3.2.5 and I guess thats what is crashing the app. I will check with the plugin makers regarding this and update this thread.
If anyone knows what a better plugin to use to show google Ads in the mobile app, please do share.
many thanks!

seems related to this other recent conversation: Building Cordova Android SDK 31 target with FCM push support

1 Like

the culprit was a cordova plugin. after removing it, the app works on android 12. :stuck_out_tongue:

1 Like

@digisarathi Can you say what plugin was the problem?

cordova-plugin-admobpro@3.2.5

2 Likes