I have an app that uses Ionic version 3 and Cordova to open the camera.
However, the Google Play Store required me to update the android-targetSdkVersion from 31 to 33. As a result, the camera opening functionality stopped working on newer devices (such as Android 11 and 12).
In Logcat at Android Studio, the following error is displayed whenever the camera button is triggered:
2023-09-19 15:35:05.799 1043-1043/? E/[email protected]: Unknown params
2023-09-19 15:35:05.800 1043-1043/? E/[email protected]: Unknown params
2023-09-19 15:35:05.805 1043-1043/? E/[email protected]: Unknown params
2023-09-19 15:35:05.805 1043-1078/? E/ANDR-PERF-LM: MetaMeter: handleAsync() 164: AdaptLaunch Invalid Async
2023-09-19 15:35:05.849 1043-1043/? E/[email protected]: Unknown params
2023-09-19 15:35:05.989 7199-7199/? E/NextAppCoreTrainingJobService: No trained model yet
Researching the problem, I found some people mentioning that I need to update to cordova-android version 12 because earlier versions no longer support the camera.
Reference: https://forum.ionicframework.com/t/camera-not-working-when-target-sdk-33/231173
So I managed to update cordova-android to 12. But the problem continued. The camera does not open and does not display any messages.
I'm not sure what to try next. Does anyone have any ideas about how to solve this?
My package.json:
{
"name": "app",
"version": "0.0.18",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build --prod",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.4.7",
"@angular/compiler": "4.4.7",
"@angular/compiler-cli": "4.4.7",
"@angular/core": "4.4.7",
"@angular/forms": "4.4.7",
"@angular/http": "4.4.7",
"@angular/platform-browser": "4.4.7",
"@angular/platform-browser-dynamic": "4.4.7",
"@ionic-native/app-version": "^4.20.0",
"@ionic-native/camera": "^4.5.2",
"@ionic-native/core": "^4.11.0",
"@ionic-native/date-picker": "^4.20.0",
"@ionic-native/geolocation": "^4.20.0",
"@ionic-native/splash-screen": "4.3.2",
"@ionic-native/status-bar": "4.3.2",
"@ionic-native/vibration": "^4.20.0",
"@ionic/app-scripts": "^3.2.4",
"@ionic/storage": "2.0.1",
"brmasker-ionic-3": "^1.6.3",
"cordova-android": "^12.0.0",
"cordova-custom-config": "^5.1.1",
"cordova-ios": "^4.4.0",
"cordova-plugin-app-version": "^0.1.14",
"cordova-plugin-camera": "6.0.0",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-datepicker": "^0.9.3",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-geolocation": "~2.4.3",
"cordova-plugin-ionic-webview": "^1.1.16",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-vibration": "^2.1.6",
"cordova-plugin-whitelist": "^1.3.1",
"dateformat": "^5.0.3",
"ion": "^1.0.1",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"node-gyp": "^9.4.0",
"rxjs": "^5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"node-sass": "7.0.3",
"typescript": "2.3.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-vibration": {},
"cordova-plugin-datepicker": {},
"cordova-plugin-device": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": " "
},
"cordova-plugin-camera": {},
"cordova-plugin-compat": {},
"cordova-custom-config": {},
"cordova-plugin-app-version": {}
},
"platforms": [
"android"
]
}
}
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.0.0-rc.13 (C:\Users\User\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.4
Cordova:
cordova (Cordova CLI) : 7.0.1
Cordova Platforms : android broken
System:
Android SDK Tools : 26.1.1
NodeJS : v17.9.1 (C:\Program Files\nodejs\node.exe)
npm : 8.11.0
OS : Windows 10