bitpay / cordova-plugin-qrscanner

A fast, energy efficient, highly-configurable QR code scanner for Cordova apps and the browser.
MIT License
575 stars 783 forks source link

Build error on Android #322

Open rpinto78 opened 4 years ago

rpinto78 commented 4 years ago

Hi,

I have installed this plugin (3.0.1) without any issue but I'm getting the following error when building on Android. Anyone else is having this issues?

Thanks in advance.

cordova 9.0.0 cordova-android 8.1.0

> Task :app:compileDebugJavaWithJavac FAILED
26 actionable tasks: 26 executed
...\App\platforms\android\gradlew: Command failed with exit code 1 Error output:
...\App\platforms\android\app\src\main\java\com\bitpay\cordova\qrscanner\QRScanner.java:459: error: no suitable constructor found for DefaultDecoderFactory(ArrayList<BarcodeFormat>,<null>,<null>)
                mBarcodeView.setDecoderFactory(new DefaultDecoderFactory(formatList, null, null));
                                               ^
    constructor DefaultDecoderFactory.DefaultDecoderFactory() is not applicable
      (actual and formal argument lists differ in length)
    constructor DefaultDecoderFactory.DefaultDecoderFactory(Collection<BarcodeFormat>,Map<DecodeHintType,?>,String,boolean) is not applicable
      (actual and formal argument lists differ in length)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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

BUILD FAILED in 10s
diogenesjup commented 4 years ago

Same here

diogenesjup commented 4 years ago

I solved the problem! In my case, I found all the plugins added in my config.xml that used the android.hardware.camera preference or any other configuration with "camera". Then I left the camera options only in one plugin. Give us what I edited I created a specific git for the installation. Example https://github.com/diogenesjup/diogenes-camera-preview

buyungSP commented 2 years ago

mBarcodeView.setDecoderFactory(new DefaultDecoderFactory(formatList, null, null)); change to mBarcodeView.setDecoderFactory(new DefaultDecoderFactory(formatList));

yellowin commented 2 years ago

@buyungSP Thanks I solved it. Thank you very much.