Issue
I have an Ionic, Angular, and Capacitor application. I have recently updated it to the latest version of Ionic 7, Angular 16, and Capacitor5. I am creating a build for the API 33. After the update, When I try to open the camera then it doesn't open the camera and throws the following exception:
Unable to create photo on disk
java.lang.IllegalArgumentException: Couldn't find meta-data for provider with authority AppID.fileprovider
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 com.capacitorjs.plugins.camera.CameraPlugin.openCamera(CameraPlugin.java:304)
at com.capacitorjs.plugins.camera.CameraPlugin.showCamera(CameraPlugin.java:175)
at com.capacitorjs.plugins.camera.CameraPlugin.doShow(CameraPlugin.java:135)
at com.capacitorjs.plugins.camera.CameraPlugin.getPhoto(CameraPlugin.java:113)
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:138)
at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:774)
at com.getcapacitor.Bridge.$r8$lambda$ehFTi5f4HhVNFKTbCKAYDkpQYRA(Unknown Source:0)
at com.getcapacitor.Bridge$$ExternalSyntheticLambda3.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.os.HandlerThread.run(HandlerThread.java:67)
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
<uses-feature
android:name="android.hardware.bluetooth"
android:required="true" />
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
<activity
android:name="AppID.MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:exported="true"
android:label="@string/title_activity_main"
android:launchMode="singleTask"
android:theme="@style/AppTheme.NoActionBarLaunch">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.file-provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
Project Info:
Ionic CLI : 7.1.1
Ionic Framework : @ionic/angular 7.0.14
@angular-devkit/build-angular : 16.1.0
@angular-devkit/schematics : 16.1.0
@angular/cli : 16.1.0
@ionic/angular-toolkit : 9.0.0
Capacitor:
Capacitor CLI : 5.1.0
@capacitor/android : 5.1.0
@capacitor/core : 5.1.0
@capacitor/ios : 5.1.0
NodeJS : v18.10.0
npm : 8.19.2
Android Studio Flamingo | 2022.2.1 Patch 2
Java 17
Gradle 8.0.0
Any Suggestion about what can be the issue and How can I resolve it?
Solution
Try to change android:authorities
for FileProvider from ${applicationId}.file-provider
to the ${applicationId}.fileprovider
Answered By - plplmax
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.