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

Android Cordova 11 build fails #397

Open
rolinger opened this issue Feb 25, 2023 · 3 comments
Open

Android Cordova 11 build fails #397

rolinger opened this issue Feb 25, 2023 · 3 comments

Comments

@rolinger
Copy link

Getting the following error:

  • 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.

I got this error on both master 3.0.1 and on a more recent fork [email protected] (May 2022).

About 2 weeks ago I read that there was issue with Cordova 11 and that someone had created another fork for it but I can't recall where I read it or find the fork that fixes it. Can anyone post that link please?

@rolinger
Copy link
Author

rolinger commented Feb 25, 2023

I got this resolved fixing the gradle script. In gradle 7.0 and higher certain methods have been replaced. Note that the compile, runtime, testCompile, and testRuntime configurations introduced by the Java plugin have been deprecated since Gradle 4.10 (Aug 27, 2018), and were finally removed in Gradle 7.0 (Apr 9, 2021).

The aforementioned configurations should be replaced by implementation, runtimeOnly, testImplementation, and testRuntimeOnly, respectively.

Thus changing the plugin src/android/qrscanner.gradle file fixed the install for me. So far, the plugin has loaded and seems to work fine now on Cordova11 (cordova-android11). Haven't tested iOS yet. Thats next after I rebuild my project for Cordova 11 on the Mac.

dependencies {
    //compile 'com.journeyapps:zxing-android-embedded:3.3.0'
    //compile 'com.android.support:appcompat-v7:23.1.0'
    implementation 'com.journeyapps:zxing-android-embedded:3.3.0'
    implementation 'com.android.support:appcompat-v7:23.1.0'
}

@v1934
Copy link

v1934 commented Feb 28, 2023

I have released update 3.0.5 of the cordova-plugin-qrscanner-11 with merged pull requests that should fix both gradle compatiblity and update the xzing-android-embedded package to a higher version, which should apparently make scanning faster.

I have tested it on my project but it's still using cordova 10, please let me know if it works for you now when using [email protected]

@DariusGalu
Copy link

A way is to go in your .gradle scanner and modify it accordingly.

android -> plugin-qrscanner -> io-qrscanner.gradle -> and instead of compile use implementation.

dependencies {
implementation 'com.journeyapps:zxing-android-embedded:3.3.0'
implementation 'com.android.support:appcompat-v7:23.1.0'
}

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

3 participants