Ionic 4 upgrade to Google Android API 31 crashes app

143 Views Asked by At

We currently have an Ionic 4 project that we upgraded to target Android API 31 but the app crashes when the permission request prompts on Android devices. (e.g. runtime permission request for location or camera)

Below is the Ionic project info:

Ionic:
Ionic CLI : 6.18.1 (D:\Users\mrws\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 4.11.13
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0

Cordova:
Cordova CLI : 11.0.0
Cordova Platforms : android 11.0.0, ios 6.2.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, cordova-plugin-ionic 5.5.3, (and 17 other plugins)

Utility:
cordova-res : not installed globally
native-run : not installed globally

System:
NodeJS : v16.13.2 (C:\Program Files\nodejs\node.exe)
npm : 8.3.2
OS : Windows Server 2016

We also tried to isolate the issue by creating a Ionic 4 test project with minimal features. But upon creating a new project in Ionic it seems that there is no option to create an Ionic 4 project. How do we do that?

Is there any other efficient way to solve the issue and meet the Google Android API 31 requirement?

We followed the migration guide to Cordova-Android 11, update the necessary plugins/dependencies and set the targetSDKVersion to 32. We managed to successfully build the app but upon running the app in an actual android device, the app crashes every time the permission request prompts.

0

There are 0 best solutions below