1

I used to work with ZXing (QR scanner) in Eclipse and I know how it works there. Now, I'm trying to the same thing in Android Studio. I have added dependencies:

dependencies {
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.google.zxing:core:3.2.0'
    compile 'com.google.zxing:android-integration:3.2.0'
}

I am having an issue with CaptureActivity in my manifest, since it's not recognized ("Cannot resolve symbol..").

This is in my AndroidManifest file:

<activity
        android:name="com.google.zxing.client.android.CaptureActivity"
        android:configChanges="orientation|keyboardHidden"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateAlwaysHidden" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter>
            <action android:name="com.google.zxing.client.android.SCAN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

I am starting QR code scanner with:

Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);

And accepting result with onActivityResult method.

I know that there is no CaptureActivity in core library, but where can I find it? Is there anything else I should add (like dependecies or anything similar) to my project?

I am not that familiar with Android Studio, I recently started using it.

Glimpse
  • 392
  • 5
  • 20
  • You can find CaptureActivity here:https://github.com/zxing/zxing/blob/master/android/src/com/google/zxing/client/android/CaptureActivity.java – tounaobun May 25 '15 at 14:21
  • @BensonTommy What should I do with it? Is it allowed to copy this code to my project? This project will go to production pretty soon for some client. – Glimpse May 25 '15 at 15:31
  • I have found a dependency to use: `compile 'info.vividcode.android.zxing:capture-activity:2.3.0-1.+'` – tounaobun May 25 '15 at 15:33
  • @BensonTommy thanks :D I will try it tomorrow when I arrive at my job and I'll let you know if it was ok. – Glimpse May 25 '15 at 17:05
  • @BensonTommy Everything works fine and I hope that there won't be any problems with License (https://github.com/zxing/zxing/wiki/License-Questions). I have read it and noticed this: "One particularly contentious issue has been reuse of Barcode Scanner's user interface.". – Glimpse May 26 '15 at 08:37
  • `zxing` is `under Apache License v2.0`,read it carefully before ship it. – tounaobun May 26 '15 at 08:47
  • Got the solution for it? – John Dec 08 '15 at 09:42
  • You have to make your own Capture Activity using ZXing library if you wan't to use it for production version. – Glimpse Dec 09 '15 at 12:19

1 Answers1

0

Maybe you can change your code to:

ref: Zxing scanner Android Studio

IntentIntegrator integrator = new IntentIntegrator(MainActivity.this);
integrator.initiateScan();
Community
  • 1
  • 1
Artis JIANG
  • 61
  • 1
  • 7