Hello,
I updated Angular from 9 to 12 (step by step) but now, I have an error when I try to build for Android.
This error is related to Gradle and the plugin “phonegap-plugin-barcodescanner”:
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.
When I look in the Github repo of this plugin, I notice that this plugin is archived
1. Is anyone have the same issue? (maybe found a fix?)
2. Is there a way to solve it and keep the same plugin or should I use another plugin?
Unfortunately, it looks like this plugin uses the old way of including native Android libraries by using compile instead of implementation. Unless the original author publishes a new version it probably won’t work unless you downgrade your tools. You could change it locally to implementation instead of compile just so you can get your application building again.
I changed the way to use this plugin in Android Studio > Project Structure > Dependencies and after this, it worked as expected (with the version 9 of Angular).
As Thomas described above, the plugin uses the old method of including native Android libraries.
So the best option is to use the Capacitor plugin (which is up to date).
Otherwise, you can change manually (in Project Structure > Dependencies tab) the field “configuration” of the the dependency barcodescanner to switch from “compile” to “implementation”.