Which capacitor min version required to support Android 11?

Hello,

I have an application using Capacitor 2.5.0 which is available on Google Play. From November, my app shall be supporting Android 11 such as new updates could continue to be submitted to Google Play.

Do I have to migrate my development environnement to Capacitor 3 or can my app support Android 11 by using Capacitor 2.5.0 ?

Thanks for your help
Best Regards
iadam

It depends on what do you mean by “support”
Any Capacitor app, even Capacitor 1 apps will work on Android 11 devices.

If you mean to target SDK 30, you can do it in Capacitor 2+ apps by changing the targetSdkVersion and compileSdkVersion from 29 to 30 in variables.gradle file. But on Android 11 devices some behaviors might change and you might need additional modifications to your project to properly support Android 11.

If you update to Capacitor 3, then those kind of things are already handled and you don’t have to worry about them.

Thank you for your clear answer.

With Capacitor 2 changing targetSdkVersion from 29 to 30 generates an error page in all my test devices and simulators.

In Chrome console there’s the error: “Not allowed to load local resource: file://localhost/”.

My app is a Ionic 3 app.

What could go wrong? I can’t find more details about the error.
I would to understand what’s wrong to fix it in my frameworks’ versions while I migrate Ionic to 5 and Capacitor to 3.

Thank you very much for your help.

Capacitor doesn’t load from file://localhost/, so it shouldn’t work on Capacitor 2 neither. You should figure out what are you doing to load from file://localhost/ instead of from http://localhost/ and stop doing it.

1 Like

@jcesarmobile I am very grateful to you, I have changed my ionic.capacitor.config.json file.

It was:
“server”: {
“androidScheme”: “file”
}
and I have replaced “file” with “http”, I don’t know why it was setted like this.

I had this error just setting targetSdkVersion to 30 but now it works too.

Thank you again for your help!

You can remove the whole server object, http is the default value

Hi @jcesarmobile , i removed the server object, but now previous db storage is inaccessible.
It’s a big problem for my users. I use Loki DB. Is there a solution to acceed via “file” scheme for a plugin?
If i add newly file scheme it works, but i can’t do it with Android API 30.

Thank you for your attention

capacitor has never worked with file (or shouldn’t have), not sure how you managed to make it work

there are cordova plugins for moving data from one scheme to other, but I can’t recommend one.

1 Like

Thanks a lot for all your help! I’ll search for it!