Error when I build with PhoneGap BarcodeScanner (ionic-native)

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 :confused:

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?

Thanks for your help & have a nice day!

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’d also recommend using the Capacitor Community Barcode Scanner if you can since it supports Capacitor 3 :grinning_face_with_smiling_eyes:

Hi Thomas,

Thank you for your reply :slight_smile:
Ok I will see to adapt this.

Kind regards

Hi 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).

A temporary fix till I change the plugin :wink:


1 Like