AnsweredAssumed Answered

Problems installing the cordova camera plugin

Question asked by Steven Cox on Feb 7, 2019
Latest reply on Feb 11, 2019 by Steven Cox

Hi,

 

I'm trying to get more interaction with the android phone camera than is available with the image field in the vanilla SDK. I'm running SDK version 6.2.1

 

I tried installing the camera plugin with the command:

 

native>$ ../cordova plugin add cordova-plugin-camera

 

and that partially worked with the error:

 

Error: Uh oh!
"/Users/stevec/GIT/...../native/platforms/android/res/xml/provider_paths.xml" already exists!

 

I compared that old file with the one being installed - and they were the same, other than some comments. So I removed the old version, and ran the command again - which worked.

 

I made changes to the custom codebase and tried to build an android debug version. But it eventually came back with the error:

/Users/stevec/GIT/...../native/platforms/android/AndroidManifest.xml:55:9-57:20 Error:
Element provider#android.support.v4.content.FileProvider at AndroidManifest.xml:55:9-57:20 duplicated with element declared at AndroidManifest.xml:39:9-41:20

Looking at lines 39 and 55, I have:

 

39:

<provider android:authorities="com.xxxxx_app.crm.fileviwerplugin.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
</provider>

 

55:

<provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
</provider>

 

 

I subsequently rebuilt the native directory with: 

./sdk init-native --platform android

 

and that cleared out the camera plugin and all built OK again. So it was definely something to do with the camera plugin.

 

Any ideas? I really need the additional camera functionality.

 

 

 

Outcomes