Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Android cannot locate methods in Intents #510

Closed
justinhenricks opened this issue Jul 19, 2017 · 5 comments
Closed

Android cannot locate methods in Intents #510

justinhenricks opened this issue Jul 19, 2017 · 5 comments

Comments

@justinhenricks
Copy link

Expected Behaviour

Android to build successfully

Actual Behaviour

Getting these errors:

BarcodeScanner.java:178: error: cannot find symbol
intentScan.putExtra(Intents.Scan.SHOW_FLIP_CAMERA_BUTTON, obj.optBoolean(SHOW_FLIP_CAMERA_BUTTON, false));
^
symbol: variable SHOW_FLIP_CAMERA_BUTTON
location: class Scan

BarcodeScanner.java:179: error: cannot find symbol
intentScan.putExtra(Intents.Scan.SHOW_TORCH_BUTTON, obj.optBoolean(SHOW_TORCH_BUTTON, false));
^
symbol: variable SHOW_TORCH_BUTTON
location: class Scan

BarcodeScanner.java:180: error: cannot find symbol
intentScan.putExtra(Intents.Scan.TORCH_ON, obj.optBoolean(TORCH_ON, false));
^
symbol: variable TORCH_ON
location: class Scan

BarcodeScanner.java:181: error: cannot find symbol
intentScan.putExtra(Intents.Scan.SAVE_HISTORY, obj.optBoolean(SAVE_HISTORY, false));
^
symbol: variable SAVE_HISTORY
location: class Scan

BarcodeScanner.java:183: error: cannot find symbol
intentScan.putExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, "" + obj.optLong(RESULTDISPLAY_DURATION));
^
symbol: variable RESULT_DISPLAY_DURATION_MS
location: class Scan

BarcodeScanner.java:192: error: cannot find symbol
intentScan.putExtra(Intents.Scan.ORIENTATION_LOCK, obj.optString(ORIENTATION));
^
symbol: variable ORIENTATION_LOCK
location: class Scan

BarcodeScanner.java:254: error: cannot find symbol
intentEncode.setAction(Intents.Encode.ACTION);
^
symbol: variable Encode
location: class Intents

BarcodeScanner.java:255: error: cannot find symbol
intentEncode.putExtra(Intents.Encode.TYPE, type);
^
symbol: variable Encode
location: class Intents

BarcodeScanner.java:256: error: cannot find symbol
intentEncode.putExtra(Intents.Encode.DATA, data);

cordova --version 6.0.4
cordova platforms Android

Attempting to build in Android Studio 2.2.3

Plugin version

phonegap-plugin-barcodescanner 6.0.8
@theknown
Copy link

Exact same error here. Does anyone have a solution?

@macdonst
Copy link
Member

@justinhenricks builds fine for me from the CLI and AndroidStudio. For some reason in your setup the .aar for ZXing is not being imported into the project which is why you get the above errors. When you open the project in AndroidStudio do you do File->New-Import Project and select the $Project_name/platforms/android directory?

@theknown
Copy link

I managed to fix it. For me this was the issue:
I had the "Cordova QR Scanner" plugin installed as well (https://github.com/bitpay/cordova-plugin-qrscanner), along with this plugin.

Apparently, both plugins don't work side by side. Removing the "cordova-plugin-qrscanner" plugin did the trick for me. I can now build it for Android without errors.

I hope this helps.

@justinhenricks
Copy link
Author

This actually ended up being our exact situation as well. QR Scanner and Barcode Scanner cannot be installed at the same time! Good to know, consider this closed. Thanks!

@lock
Copy link

lock bot commented Jun 8, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants