I've been looking all over internet how to include zxing library to my project, and I found this tutorial: http://blog.dihaw.com/integrating-zxing-in-your-android-app-as-standalone-scanner/
But when I reach the point that you need to check for BeepManager to add the R import I get all kinds of errors in my project (Even on the MainActivity) that it couldn't find R.
Also I found this one https://github.com/journeyapps/zxing-android-embedded/blob/master/README.md which seemed a lot easier because it was auto integrated by gradle, but when I sync it pops an error that it couldn't find the files.
Any help would be appreciated :) I'm new to Android Studio.
EDIT:
I added the settings of the 2nd method (the one with the gradle settings) to my build.gradle and 4 error pop up:
Error:Failed to find: com.embarkmobile:zxing-android-legacy:2.0.0
Error:Failed to find: com.google.zxing:core:3.0.1
Error:Failed to find: com.embarkmobile:zxing-android-integration:2.0.0
Error:Failed to find: com.embarkmobile:zxing-android-minimal:2.0.0
Any help?
---ANSWER---
To fix this problem I needed to disable Offline Work on Gradle. Go into Android Studio's settings>Gradle>Uncheck 'offline work' After that, you're good to go!
As of version 3 of zxing-android-embedded you only need to add these to your
build.gradle
file:Follow the steps in: https://github.com/journeyapps/zxing-android-embedded/
It now also allows for portrait mode with simple changes to the
IntentIntegrator
, and easier ways to customize the views.You need add the following to your
build.gradle
file:My
build.gradle
file like this:The code is here.
Also, for how to use it, please refer my answer on the Stackoverflow here
It contains method and also simple code that I have tested.
I have it working with this:
I recommend using the IntentIntegrator
The requestCode comes back with IntentIntegrator.REQUEST_CODE
Easiest way to integrate ZXing for barcode or Qr scanning.
For Full Reference : Scan Barcode ZXing Android
Add in dependencies
ScanActivity