Embed Zxing Library Without Using Barcode Scanner App

Embed Zxing library without using Barcode Scanner app

It's really easier to just integrate via Intent. More reliable, and you get updates automatically. While I don't advise it...

The complete source code is available from the ZXing project. You want to build core.jar from core/ and put it in your Android lib/ folder to include the core decoder in your app. You do not want to include javase. You can look to the code in android/ as it is the source to Barcode Scanner, but as the authors we'd suggest you not just copy and paste it.

It is Apache licensed which means you can use it freely, as long as you essentially give the user access to the license terms.

How to use ZXing library without installing barcodescanner app

I found "zxing" complicated to use. Then I tried with "ZBar Android Version Library". It was so simple.
You can download the library from here: http://sourceforge.net/p/zbar/news/2012/03/zbar-android-sdk-version-01-released/

Within the downloaded package, there is a very simple example. Just follow it or include the example to your app. Hopefully your task will be done.

Integrate ZXing QR code scanner without installing BarCode Scanner

Finally I got the answer,

As of ADT 14,the resource fields(such as R.id.decode) are no longer constants when defined in library projects

So in the ZXing library->android->com.google.zxing.client.android.CaptureActivityHandler.java and DecodeHandler.java

Replace both of these classes switch case statements with if-else,and then import this ZXing library into your project..

Rest of the coding of my own project is same...just the problem with the library classes as these are not updated as according to ADT 14..

Kanika

Application Using Barcode scanner without Library Project

I don't know what I am doing is right or wrong,but it worked for me perfectly.

  1. I just copied and appended the files in the res folder of my barcode application with the files in the res folder of my Hybrid application
  2. I had taken the Captureactivity.jar file in the bin folder of the barcode application and placed it in the libs folder of my hybrid application
  3. modified config.xml file in my hybrid application with the appropriate plugin reference,
  4. copied the com-->phonegap-->plugins-->bacodescanner-->barcodescanner.java in the src folder.
  5. run the android project.

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

I don't know why it happened, but finally I use another library. I use Zxing-android-minimal and tutorial from here and here. Now it works.

How to integrate Zxing without installing barcode scanner application?

+1 for your question. I tried this but no luck then I added it's code files in my app. If you wish you can also do that. Here ia a link:

http://code.google.com/p/zxing/source/browse/trunk#trunk%2Fandroid

If you get any better way then let me know.

Integrating the ZXing library directly into my Android application


UPDATE! - SOLVED + GUIDE

I've managed to figure it out :) And down below you can read step-by-step guide so it hopefully can help others with the same problem as I had ;)

  1. Install Apache Ant - (See this YouTube video for config help)
  2. Download the ZXing source from ZXing homepage and extract it
  3. With the use of Windows Commandline (Run->CMD) navigate to the root directory of the downloaded zxing src.
  4. In the commandline window - Type ant -f core/build.xml press enter and let Apache work it's magic [having issues?]
  5. Enter Eclipse -> new Android Project, based on the android folder in the directory you just extracted
  6. Right-click project folder -> Properties -> Java Build Path -> Library -> Add External JARs...
  7. Navigate to the newly extracted folder and open the core directory and select core.jar ... hit enter!

Now you just have to correct a few errors in the translations and the AndroidManifest.xml file :) Now you can happily compile, and you will now have a working standalone barcode scanner app, based on the ZXing source ;)

Happy coding guys - I hope it can help others :)

Embedding ZXing in android app

I had to do exactly what you are being asked to do. It wasn't that easy, but it wasn't too bad either. It was also my very first (commercial or otherwise) Android app.
What I did was:

  • Get the ZXing project compiled
    and running on your machine. There
    is a good tutorial on how to do this here.
  • Adapt this code to suit your needs. I stripped a lot of the project away to just the basic scanner. I then built the rest of my project around it. Here's how to do that.

  • Adapt the CaptureActivity in core to be as simple as possible. All you need is the number returned from the core scanner code. Here's a picture of the structure of my project:

Structure of Adapted ZXing project

  • What you'll find is that you need to Modify 4 files for your modified Activity Class to work. These files are The CameraCaptureActivity class, The CaptureActivityHandler class, and the Decode Thread and Decode handler classes. I've hosted these files here.

  • Take these four files and put them in a copy of your ZXing working project. Remove the original CaptureActivity and the other Original Threads and Handler Classes that you have replaced. (Ignore the CaptureActivityHandlerDemo file, as it was put up there by mistake)

  • Change the package names to match the working ZXing package names. Make sure that your Activity is named the same in all four of these Classes. It might be a good idea to pass in an interface that implements "getHolder" rather than the Activity Class itself.

  • Make sure you have updated your manifest with any changes to your Activity Name. Make sure you have a way of navigating to the activity - perhaps make it the default class in the intent filter area.

  • I have included a layout file for your activity also - it's very simple, but it's all your need to get the scanner up and working. it's called camera_capture.xml

Hopefully this is all you need to get up and running. It's not an easy process and unfortunately I can't give you my entire project as it's a commercial product.

Good Luck!!

PS please post any questions as comments on this answer and I'll do my best to help.



Related Topics



Leave a reply



Submit