Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cordova qrcode scanner #1758

Closed
FranGhe opened this issue Jan 8, 2025 · 1 comment
Closed

cordova qrcode scanner #1758

FranGhe opened this issue Jan 8, 2025 · 1 comment

Comments

@FranGhe
Copy link

FranGhe commented Jan 8, 2025

I would like to scan the QR code with my Cordova app but I'm having trouble build it.
I searched for some plugins to do this but the ones I found are old and it fails in the build.

These are the plugin found:
https://github.com/phonegap/phonegap-plugin-barcodescanner
this is the error:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Script '[mypath]/platforms/android/phonegap-plugin-barcodescanner/cortona-barcodescanner.gradle' line: 9

* What went wrong:
A problem occurred evaluating script.
> Could not find method compile() for arguments [{name=barcodescanner-release-2.1.5, ext=aar}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

and the other one
https://github.com/bitpay/cordova-plugin-qrscanner
this is the error:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Script '[mypath]/platforms/android/cordova-plugin-qrscanner/cortona-qrscanner.gradle' line: 6

* What went wrong:
A problem occurred evaluating script.
> Could not find method compile() for arguments [com.journeyapps:zxing-android-embedded:3.3.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

The issues is the same.

Is it possible that there are no plugins to scan qr code?... or is there another way that I haven't evaluated?

@breautek
Copy link
Contributor

breautek commented Jan 9, 2025

Based on the given output for the first one, barcodescanner it looks like it might include its own gradle files which hasn't been updated.

Could not find method compile()

This refers to dependency references, in most cases the suitable replacement is implementation.

Old:

dependencies {
    compile 'foo:1.0.0'
}

New:

dependencies {
    implementation 'foo:1.0.0'
}

A problem occurred configuring project ':app'.
compileSdkVersion is not specified. Please add it to build.gradle

This is saying that the app module (a module that Cordova manages) is missing compileSdkVersion. Does not appear to be related to the plugin. So this suggest that you might be using an older cordova-android version, but perhaps with gradle version overrided. cordova-android@13 should be setting this property in its builds. It might be that the plugin is causing the native project to not fully generate too.

For the QR scanner plugin, it looks like it suffers from the same issues, but I had a peak at https://github.com/bitpay/cordova-plugin-qrscanner/blob/master/src/android/qrscanner.gradle and it uses jcenter which is now defunct. If the required dependencies are not available elsewhere this plugin may not be fixable.

Additionally it uses com.android.support:appcompat-v7:23.1.0 which might not be compatible with AndroidX applications (which Cordova now uses).

Is it possible that there are no plugins to scan qr code?... or is there another way that I haven't evaluated?

Certainly is possible. You can try scanning through forks (https://github.com/phonegap/phonegap-plugin-barcodescanner/forks or https://github.com/bitpay/cordova-plugin-qrscanner/forks), or even fork the plugin itself. It seems obvious that the original authors are no longer maintaining these plugins. Alternatively a new plugin can be created.

I'm closing this issue because it doesn't describe any issues related to Apache's Cordova Android. But I hope the information I've provided helps.

@breautek breautek closed this as not planned Won't fix, can't repro, duplicate, stale Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants