简体   繁体   中英

Scan the barcode in Google glass using Android Studio

I am using Android Studio as an IDE to develop the Google Glass Application.

Here is the code I am using:

Intent intent = new Intent(context, com.google.zxing.client.android.CaptureActivity.class);

But it gives the error saying cannot resolve symbol 'android'.

I have added the Gradle dependency as below:

compile 'com.google.zxing:core:2.3.0'

Because of this, I cannot run the project. Please let me know what can be done to resolve the issue. Also if any other or better alternative is available, please let me know.

Since you are just including the ZXing core you won't have any of the Android code for ZXing.

Take a look at BarcodeEye: https://github.com/BarcodeEye/BarcodeEye

Adding core won't do anything if you are integrating by Intent . You need android-integration , if anything, to use IntentIntegrator . Starting the Intent as you show won't quite work. Also, you should use a much newer version -- 3.1.0, not 2.3.0. Finally you need to build and install the Glass app, which is in the project at glass/ . I have not tested it with Intent s but someone mentioned it works?

For scanning bar codes I'm using zbar libraries. I have downloaded and added the zbar.jar into the libs folder of my Android Studio Project and then added to the gradle dependencies like:

dependencies {
    ....
    compile files('libs/zbar.jar')
} 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM