apache / apache/cordova-plugin-camera
Android 13 app crashes when trying to access the provider-path meta-data file
- Dominant language
- Objective-C
- Stars
- 976
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
Android 13
App crashes when permission is granted for the first time. After requesting the permission once, the "Take Picture" button has no effect. Selecting an image from the gallery works.
**Note: This only happens in the Release version from the store**
### What is expected to happen?
Upon requesting the permission to take photos the camera intent should start and i should be able to take a photo with the camera
### What does actually happen?
App is crashing when when granting the permission to take photos
https://github.com/apache/cordova-plugin-camera/assets/154965518/38d90cca-6dd0-4015-bcd5-b1a14634d4c1
## Information
This is the stacktrace from logcat
`FATAL EXCEPTION: main
Process: com.newsolutions.checkware2, PID: 14859
java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=0, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.newsolutions.checkware2/com.newsolutions.checkware2.MainActivity}: java.lang.IllegalArgumentException: Couldn't find meta-data for provider with authority com.newsolutions.checkware2.cordova.plugin.camera.provider
at android.app.ActivityThread.deliverResults(ActivityThread.java:5994)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:6033)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.IllegalArgumentException: Couldn't find meta-data for provider with authority com.newsolutions.checkware2.cordova.plugin.camera.provider
at androidx.core.content.FileProvider.getFileProviderPathsMetaData(FileProvider.java:664)
at androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:695)
at androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:645)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:449)
at org.apache.cordova.camera.CameraLauncher.takePicture(CameraLauncher.java:332)
at org.apache.cordova.camera.CameraLauncher.onRequestPermissionResult(CameraLauncher.java:1394)
at org.apache.cordova.CordovaInterfaceImpl.onRequestPermissionResult(CordovaInterfaceImpl.java:222)
at org.apache.cordova.CordovaActivity.onRequestPermissionsResult(CordovaActivity.java:527)
at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:9124)
at android.app.Activity.dispatchActivityResult(Activity.java:8955)
at android.app.ActivityThread.deliverResults(ActivityThread.java:5987)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:6033)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) `
### Command or Code
Blank app with camera plugin
### Environment, Platform, Device
Android 13 Samsung Galaxy A32
Android 13 Lenovo Tab M10 Plus 3rd Gen
Android 13 Samsung Galaxy Tab S7
Android 14 Google Pixel Pro 7
Works fine on Android 12 and below and also on LineageOS Android 13
### Version information
packages.json
```
`"dependencies": {
"@angular/animations": "^15.2.9",
"@angular/common": "^15.0.4",
"@angular/core": "^15.0.4",
"@angular/forms": "^15.0.4",
"@angular/platform-browser": "^15.0.4",
"@angular/platform-browser-dynamic": "^15.0.4",
"@angular/router": "^15.0.4",
"@awesome-cordova-plugins/barcode-scanner": "^6.6.0",
"@awesome-cordova-plugins/camera": "^6.6.0",
"@awesome-cordova-plugins/core": "^6.6.0",
"@awesome-cordova-plugins/device": "^6.6.0",
"@awesome-cordova-plugins/document-picker": "^6.6.0",
"@awesome-cordova-plugins/file": "^6.6.0",
"@awesome-cordova-plugins/file-chooser": "^6.4.0",
"@awesome-cordova-plugins/file-path": "^6.6.0",
"@awesome-cordova-plugins/geolocation": "^6.6.0",
"@awesome-cordova-plugins/http": "^6.6.0",
"@awesome-cordova-plugins/insomnia": "^6.6.0",
"@awesome-cordova-plugins/keyboard": "^6.6.0",
"@awesome-cordova-plugins/nfc": "^6.6.0",
"@awesome-cordova-plugins/splash-screen": "^6.6.0",
"@awesome-cordova-plugins/status-bar": "^6.6.0",
"@ionic/angular": "^6.4.1",
"@ionic/core": "^6.4.1",
"@ionic/storage": "^4.0.0",
"@ionic/storage-angular": "^3.0.6",
"@iplab/ngx-color-picker": "^15.0.0",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"cordova": "^12.0.0",
"font-awesome": "^4.7.0",
"gulp-json-editor": "^2.5.6",
"jquery": "^3.6.2",
"js-base64": "^3.7.3",
"keycloak-angular": "^13.0.0",
"keycloak-js": "^20.0.2",
"knockout": "^3.4.2",
"localforage-cordovasqlitedriver": "^1.8.0",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"rxjs": "~6.6.0",
"signature_pad": "^4.1.6",
"sqlite3": "^5.1.4",
"zone.js": "^0.11.8"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.4",
"@angular/cli": "^15.0.4",
"@angular/compiler": "^15.0.4",
"@angular/compiler-cli": "^15.0.4",
"@angular/language-service": "^15.0.4",
"@ionic/angular-toolkit": "^7.0.0",
"@ionic/cordova-builders": "^7.0.0",
"@ionic/lab": "3.2.10",
"@red-mobile/cordova-plugin-barcodescanner": "file:src/plugins/cordova-plugin-barcodescanner",
"@share911/cordova-universal-links-plugin": "^1.2.5",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/knockout": "^3.4.72",
"@types/node": "^12.20.55",
"@typescript-eslint/eslint-plugin": "4.16.1",
"@typescript-eslint/parser": "4.16.1",
"compare-func": "^2.0.0",
"cordova-android": "^12.0.1",
"cordova-browser": "^7.0.0",
"cordova-custom-config": "^5.1.1",
"cordova-documentpicker": "^1.2.2",
"cordova-electron": "^2.0.0",
"cordova-ios": "^7.0.1",
"cordova-plugin-advanced-http": "^3.3.1",
"cordova-plugin-browsertab": "file:src/plugins/cordova-plugin-browsertab",
"cordova-plugin-camera": "^7.0.0",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^2.1.0",
"cordova-plugin-file": "^8.0.1",
"cordova-plugin-filechooser": "^1.2.0",
"cordova-plugin-filepath": "^1.6.0",
"cordova-plugin-geolocation": "^5.0.0",
"cordova-plugin-inappbrowser": "^6.0.0",
"cordova-plugin-insomnia": "^4.3.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "file:src/plugins/cordova-plugin-ionic-webview",
"cordova-plugin-statusbar": "^4.0.0",
"cordova-sqlite-storage": "^6.1.0",
"cordova-universal-links-plugin": "file:src/plugins/cordova-universal-links-plugin",
"electron-builder": "22.10.5",
"eslint": "^7.6.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"gulp": "^4.0.2",
"gulp-cheerio": "^1.0.0",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.1",
"karma-coverage": "~2.0.3",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "^4.0.2",
"karma-jasmine-html-reporter": "^1.7.0",
"phonegap-nfc": "file:src/plugins/phonegap-nfc",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslib": "^2.6.2",
"typescript": "~4.8.4"
},
"description": "Checkware 2",
"cordova": {
"plugins": {
"cordova-plugin-filechooser": {},
"cordova-plugin-filepath": {},
"cordova-plugin-geolocation": {
"GPS_REQUIRED": "true",
"GEOLOCATION_USAGE_DESCRIPTION": "in checklist"
},
"cordova-plugin-insomnia": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-sqlite-storage": {},
"cordova-plugin-inappbrowser": {},
"cordova-universal-links-plugin": {},
"cordova-plugin-camera": {
"ANDROIDX_CORE_VERSION": "1.6.+"
},
"cordova-plugin-browsertab": {
"CUSTOM_TAB_COLOR_RGB": "#ffffff"
},
"cordova-plugin-compat": {},
"cordova-plugin-device": {},
"cordova-plugin-file": {
"ANDROIDX_WEBKIT_VERSION": "1.4.0"
},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-statusbar": {},
"phonegap-nfc": {
"NFC_USAGE_DESCRIPTION": "Read NFC Tags"
},
"cordova-plugin-advanced-http": {
"ANDROIDBLACKLISTSECURESOCKETPROTOCOLS": "SSLv3,TLSv1"
},
"@red-mobile/cordova-plugin-barcodescanner": {
"ANDROIDX_LEGACY_SUPPORT_V4_VERSION": "1.0.0"
}
},`
```
Generated AndroidManifest.xml
```
`
`
```
## Checklist
- [ X] I searched for existing GitHub issues
- [ X] I updated all Cordova tooling to most recent version
- [ X] I included all the necessary information above
Contributor guide
Research direction
Start with org.apache.cordova.camera.CameraLauncher.takePicture and onRequestPermissionResult, then inspect the generated AndroidManifest.xml and the cordova-plugin-camera configuration in packages.json. Reproduce the first-time camera permission flow in an Android 13 release build; done means the camera intent starts without the provider meta-data crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100