Ionic 4 upgrade to Android API 31 crashes app

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 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 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)

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

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?