Closed AlibekJ closed 5 years ago
Hi @AlibekJ,
this is a bug in Cordova, problem is not in the blinkid-phonegap plugin nor cordova-plugin-qrscanner. But you can take a look at this issue, maybe you can find a workaround.
Thanks for the link. I understand it is not your bug, but it is still a major issue which makes your product unusable. Would be great if you could spend some time to find the solution and provide detailed how-to document.
Hi,
Both of the plugins you want to use in your project have the same camera permission where one specifically requires it and other don't, therefore Cordova will generate AndroidManifest.xml
with conflicting permissions.
Since the bug is in Cordova, we can only suggest you the following workaround.
After creating new cordova project, firstly add blinkid plugin. When plugin is successfully added, open plugins/com.microblink.BlinkIDScanner/plugin.xml
and comment lines that are causing problem:
<uses-permission android:name="android.permission.CAMERA" ></uses>
<uses-feature android:name="android.hardware.camera" ></uses>
Now, you can add qrscanner plugin and android platform. The reason why the blinkid plugin was added before the android platform is so we can modify plugin.xml
file so it doesn't generate duplicate lines in AndroidManifest.xml
.
If you try to run your app now, you will get error saying:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
This error occurs because there are 2 versions of support libraries, qrscanner uses com.android.support:support-v4:23.1.0
and other dependencies have 27.1.1
version. To fix that, simply create build-extras.gradle
in platforms/android/app
with newer library version:
dependencies {
implementation 'com.android.support:support-v4:27.1.1'
}
Finally, you just need to clean the project (cordova clean
) and run the app (cordova run android
) and it should work.
Best regards, Sandra
yay, worked fine. Thank you very much, Sandra.
Here is how to reproduce the error:
And it fails with