1

I'm trying to make an app that should be able to scan barcodes. It should work without installing the external Zxing app. I already searched for an answer and found this:

How to integrate Zxing Barcode Scanner without installing the actual zxing app (cannot resolve symbol: .android.CaptureActivity)?

The answers refer to Eclipse, but if try to do the same in Android Studio, I don't know where to start.

Community
  • 1
  • 1
patvax
  • 343
  • 3
  • 14
  • If you scroll down to the bottom of the post you linked, you'll find a gradle compatible project: https://github.com/journeyapps/zxing-android-embedded or you can import the original project into Android Studio and in gradle use `compile files: ` – Pztar Jan 28 '16 at 18:31
  • I tryied it, but I don't know how to import it in Android Studio. – patvax Jan 28 '16 at 18:55

1 Answers1

1

Try adding this to your build.gradle file

dependencies {

    // other dependencies

    // ZXing
    // Supports Android 4.0.3 and later (API level 15)
    compile 'com.journeyapps:zxing-android-embedded:2.0.1@aar'

    // Convenience library to launch the scanning and encoding Activities.
    // It automatically picks the best scanning library from the above two, depending on the
    // Android version and what is available.
    compile 'com.journeyapps:zxing-android-integration:2.0.1@aar'

    // Version 3.0.x of zxing core contains some code that is not compatible on Android 2.2 and earlier.
    // This mostly affects encoding, but you should test if you plan to support these versions.
    // Older versions e.g. 2.2 may also work if you need support for older Android versions.
    compile 'com.google.zxing:core:3.2.1'

}
MidasLefko
  • 4,499
  • 1
  • 31
  • 44
  • Do I have to import the project somehow? If yes how should I do that? I don't get the modules idea. – patvax Jan 28 '16 at 18:53