cordova-plugin-camera-preview / cordova-plugin-camera-preview

Cordova plugin that allows camera interaction from HTML code
MIT License
567 stars 559 forks source link

Android Studio forces me to set android:exported="true" in AndroidManifest.xml #681

Open nhh opened 1 year ago

nhh commented 1 year ago

Maybe the same error from #585

Using SDK 31 you need to actively set android:exported="true" to every intent inside your manifest explicitely. I did this and everything is fine.

The moment I ran ionic cordova build the plugin.xml will be merged with the AndroidManifest.xml. This will cause a duplicate fragment error, because there are two intents, from your plugin.xml and the manually edited with android:exported="true"

For me the fix was to edit node_modules/cordova-plugin-camera-preview/plugin.xml:

    <config-file target="AndroidManifest.xml" parent="/manifest/application">
      <activity android:exported="true" android:name="com.cordovaplugincamerapreview.CameraActivity" android:screenOrientation="portrait" android:theme="@style/CameraPreviewTheme" />
    </config-file>

I dont know what android:exported="true" is doing and I dont care. (I'm so done with the android platform)

Maybe you can add this too so everybody does not need to figure this out on themself? 🫶

nhh commented 1 year ago

Error message:

Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present'