Add ZXing android project as library in android studio

12,308

Simple way with mvn repo:

dependencies {
   compile 'com.google.zxing:core:3.0.0'
}

The more work version without mvn repo:

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

So whichever version you pick, look for the dependencies block in your build.gradle, then add in the appropriate compile line. Remember to add it into the build.gradle for your app module, not the root build.gradle.

Sample directory layout: /approot

/approot/build.gradle

/approot/myfancyapp

/approot/myfancyapp/build.gradle <--- this one!

/approot/myfancyapp/libs/zxing/core.jar <--- put the jar here or any path, just an example.

Share:
12,308
Ryan95
Author by

Ryan95

Updated on June 25, 2022

Comments

  • Ryan95
    Ryan95 almost 2 years

    I am making an app in android studio that uses a bar code scanner. I am using the Google ZXing lib. I downloaded the zip, opened the project and added the core.jar file as instructed but the tutorial was for eclipse and there is no option to add as library in android studio. so I am stuck on how to add it. any help would be greatly appreciated :)

  • Aman Grover
    Aman Grover over 8 years
    If I add this dependency , and then use zxing with intents, will the app still ask us to download barcode scanner from google play?