Fixed ionic 6 application not installed on android 11
do below things step by step
To Add Android 11 Support You Need To Install
-
Cordova 10
-
latest version of android studio
-
android build tools 30.0.2
-
android sdk platform level 30
1- updgrade your cordova to cordova version 10.0.0
you can remove your old cordova with type this code in terminal
npm uninstall -g cordova
and then install cordova version 10.0.0
npm install -g cordova@10.0.0
2- update Android SDK Platform to level 30 and 31 (but for android 11 level 30 is ok ) from android studio exactly like below image
3- update Android SDK Build Tools from android studio exactly like below image
4- update your Android Studio Version like below image
5- remove old platform from your project and add new android project
ionic cordova platform add android@latest or ionic cordova platform add android@10.0.0
latest version is 10.1.0 now
5- upgrade your gradle to 7.1.1 (this section will happen automate after you add android@10.x to your project)
if you give an error about gradle version just check below image your wrapper should be the same
5.1- add to config.xml
<preference name="android-targetSdkVersion" value="30" />
<preference name="hostname" value="localhost" />
<preference name="AndroidInsecureFileModeEnabled" value="true" />
6- prepare android
ionic cordova prepare android
7- build your app
ionic cordova build android --prod
run your app on emulator (android 11) and check console in chrome://insepct
if you get this error
ionic Failed to load resource: net::ERR_FILE_NOT_FOUND
open config.xml file and and some code
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="*" />
<allow-navigation href="data:*" />
<allow-intent href="*" />
<access origin="*" />
and for me i changed tsconfig.json file
“target”: “es5”,
if you get whitelist error when build android app just remove whitelist
With the Allow List functionality now integrated into the core of Cordova Android (10.x and greater), this plugin is no longer required.
ionic cordova plugin rm cordova-plugin-whitelist
For me This changes work i hope it will help
below links maybe help as refrences
1-whitelist
2-cordova