Phonegap-plugin-barcodescanner: Issue dependency cordova-plugin-compat

Created on 25 Oct 2017  路  13Comments  路  Source: phonegap/phonegap-plugin-barcodescanner

I get the problem with the following error message:

D:\barcode_scanner>cordova` plugin add cordova-plugin-compat --save
Installing "cordova-plugin-compat" for android
Plugin doesn't support this project's cordova-android version. cordova-android:
6.3.0, failed version requirement: <6.3.0
Skipping 'cordova-plugin-compat' for android
Adding cordova-plugin-compat to package.json
Saved plugin info for "cordova-plugin-compat" to config.xml

according https://github.com/apache/cordova-plugin-compat, cordova-plugin-compat is now included in cordova-android 6.3.0, no need add plugin again.

What code should I change to support for cordova-android 6.3.0?

bug

Most helpful comment

Not solved - see #565.

I got v6.0.8 to work with android platform v6.3.0 as explained at https://stackoverflow.com/questions/46562289/multiple-dex-files-define-lorg-apache-cordova-buildhelper/46957938#46957938:

phonegap plugin rm cordova-plugin-compat --force
phonegap plugin add [email protected]
phonegap platform rm android
phonegap platform add [email protected]

So maybe upgrading cordova-plugin-compat to v1.2 instead of removing it might have been a better option.

All 13 comments

yeah, it's included. But as it's not installed for Android you should not have problems using barcode scanner plugin.
Anyway we should remove the dependency. The code is located in plugin.xml and package.json, feel free to send a PR

still showing the same error when cordova build android.

D:\barcode_scanner>cordova plugin rm cordova-plugin-compat --save
Error: The plugin 'cordova-plugin-compat' is required by (cordova-plugin-barcode-scanner), skipping uninstallation. (try --force if trying to update)

D:\barcode_scanner>cordova plugin rm cordova-plugin-compat --save --force
The plugin 'cordova-plugin-compat' is required by (cordova-plugin-barcodescanner
) but forcing removal
Uninstalling cordova-plugin-compat from android
Removing "cordova-plugin-compat"
"cordova-plugin-compat" is required by (cordova-plugin-barcodescanner) but forcing removal.
Removing plugin cordova-plugin-compat from config.xml file...
Removing cordova-plugin-compat from package.json

D:\barcode_scanner>cordova build android
ANDROID_HOME=C:\Users\IHSANA\AppData\Local\Android\sdk\
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65\
Subproject Path: CordovaLib The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead. at build_7b85bpvs7evi3dyajqu6gxtnv.run(D:\barcode_scanner\platforms\andr
oid\build.gradle:141)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is schedu
led to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be
removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
[Fatal Error] :18:139: The value of the attribute "prefix="xmlns",localpart="android", rawname="xmlns:android"" is invalid. Prefixed namespace bindings may not be empty.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Exception while parsing the supplied manifest file D:\barcode_scanner\platform
s\android\AndroidManifest.xml

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 1.504 secs
Error: cmd: Command failed with exit code 1 Error output:
[Fatal Error] :18:139: The value of the attribute "prefix="xmlns",localpart="and
roid",rawname="xmlns:android"" is invalid. Prefixed namespace bindings may not b
e empty.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Exception while parsing the supplied manifest file D:\barcode_scanner\platform
s\android\AndroidManifest.xml

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

but no problem if without cordova-plugin-barcodescanner
```
D:\barcode_scanner>cordova plugin rm cordova-plugin-barcodescanner --save
Uninstalling cordova-plugin-barcodescanner from android
Removing "cordova-plugin-barcodescanner"
Removing plugin cordova-plugin-barcodescanner from config.xml file...
Removing cordova-plugin-barcodescanner from package.json

D:\barcode_scanner>cordova build android
ANDROID_HOME=C:\Users\IHSANA\AppData\Local\Android\sdk\
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65\
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be r
.........
BUILD SUCCESSFUL

Total time: 29.436 secs
Built the following apk(s):
D:/barcode_scanner/platforms/android/build/outputs/apk/android-debug.ap
````

I've released a 7.0.0 version to resolve this issue. If you are using cordova android 6.3.0 or later you should pin your barcode scanner version to 7 or higher. For those who are still on cordova-android < 6.3.0 continue using barcode scanner ^6.0.0

solved, thank you

Not solved - see #565.

I got v6.0.8 to work with android platform v6.3.0 as explained at https://stackoverflow.com/questions/46562289/multiple-dex-files-define-lorg-apache-cordova-buildhelper/46957938#46957938:

phonegap plugin rm cordova-plugin-compat --force
phonegap plugin add [email protected]
phonegap platform rm android
phonegap platform add [email protected]

So maybe upgrading cordova-plugin-compat to v1.2 instead of removing it might have been a better option.

@jlchereau nope, we want to get rid of compat altogether. If you are using cordova-android >= 6.3.0 use barcodescanner 7+. If you are using cordova-android < 6.3.0 use barcode scanner ^6.

Where do we get barcodescanner 7+ ? The releases only show 6.0.5 as the highest version ( https://github.com/phonegap/phonegap-plugin-barcodescanner/releases ).

OK, thanks!

If you are using cordova-android >= 6.3.0 use barcodescanner 7+. If you are using cordova-android < 6.3.0 use barcode scanner ^6.

This should be in big letters at the top of the readme. I spent all day trying to figure out how to get this thing to build on 6.3...

We expect people to always use latest version of everything.

Anyway, package.json has a section for cordova dependencies where you can sort of guess which versions to use with each cordova version.

this solved - see #565.

I got v7 to work with android platform v6.3.0 as explained at.


    • phonegap plugin rm cordova-plugin-compat --force


    • ionic cordova platform rm android

So maybe upgrading cordova-plugin-compat to v1.2 instead of removing it might have been a better option.

This thread has been automatically locked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

klickagent picture klickagent  路  3Comments

jrobichaud picture jrobichaud  路  9Comments

Bajranghudda1 picture Bajranghudda1  路  4Comments

brunovinny picture brunovinny  路  6Comments

HallmediaDigital picture HallmediaDigital  路  4Comments