Integrate zxing barcode scanner into your Android app natively using Eclipse
June 13, 2011
Update: Please note that this tutorial was written over a year ago. ZXing has moved on quite a bit since then as have the Android Developer Tools. I haven’t had time to revisit and update the post but it should give you a good steer in the right direction. Some of the comments at the bottom may be able to help you out if you encounter any troubles.
Edit: Sean Owen, one of the developers for ZXing has posted a comment to this blog warning of the pitfalls of integrating ZXing into your own app; doing so just to avoid having your users take that extra step of installing from the market is not a good reason. I completely agree with this. There are many advantages to using the intent based approach as outlined in his comments. My motivation is for an enterprise app that does not have access to the Android market and involves my client installing zxing manually on thousands of devices before they are able to distribute to its business customers.
So to be clear, do not use this method unless it is absolutely necessary, and if you do have to – make sure that override your intent filters so that other apps that want to use zxing do not end up calling your modified version. Also, if zxing is already installed, then you should use that by default instead of your modified version.
ZXing is one of the most popular barcode scanning applications on the market. They make it very easy for you to integrate into your application via an intent but this means that your users must manually install the application from the market.
Fortunately, the app is also open source so I will show you how to cleanly build this capability into your project.
Please note that the awesome developers of this product have released the src under the Apache v2.o license so please be sure to adhere to the terms of this license and give them full credit for their work. http://www.apache.org/licenses/LICENSE-2.0
Step One: Obtain the zxing src code
The src can be found at http://code.google.com/p/zxing/source/browse/trunk. Specifically you only need the android/ and the core/ projects. Use svn to checkout these to your local hard-drive.
Step Two: Build zxing core using Apache Ant
You will need to build the core project into a jar file using apache ant (download from here http://ant.apache.org/ivy/download.cgi). Using a shell or cmd prompt navigate to the root directory of the downloaded zxing src and execute ”ant -f core/build.xml”. This will produce a file core/core.jar which we will use in the next step.
Step Three: Build ZXing Android using Eclipse
Create a New Android Project (File –> New –> Android Project).
Set the project name to ZXing (or similar).
Select the “Create project from existing source” radio button
Click “Browse” and navigate to the android project that you downloaded from zxing and click “OK”
Select “Finish”
The project will not currently build. We need to add the core.jar file (that we produced in the previous step) into our project. Right-click on ZXing project –> properties –> Java Build Path –> Add External Jars –> Navigate to and select core.jar –> Open –> OK.
Actually, while we’re here we should do one more very important thing! Right-click on ZXing project –> properties –> Android –> Scroll down and check/tick the “Is Library” checkbox –> OK.
Step 4: Include ZXing Android into your project.
Within Eclipse, Right-click on YOURPROJECTNAMEHERE project –> properties –>Android –> Scroll down to Libraries section –> Click Add –> Select ZXing (which should appear as an option as a result of completing previous step).
Next, in some trigger function e.g. button press within your code you should add:
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
In the same activity you’ll need the following to retrieve the results:
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}
Almost there! One of the current limitations of Android Library projects is that it will not pull anything from AndroidManifest.xml into your project.
So if we try to invoke the above code we will receive a runtime exception because your Android app has no idea how to handle the scan intent.
To fix this you just need to copy the following into your AndroidManifest.xml:
<activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden"
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>
And as Columbo would say, “Just one more thing!”. Add this permission to the top of your AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA"/>
EDIT: You need to do yet one more thing! You need to add the core.jar (produced in Step two) to your new project (Right-click your project –> Properties –> Java Build Path –> Add External JARS… –> Select core.jar –> OK). Thanks to Marco and Markosys in the comments for spotting and pointing out the omission!

June 14, 2011 at 1:52 pm
Thanks for this post. It was really helpfull. But i have the problem that the retangle with the red laser line is in the right corner and not in the middle of the screen… i use a android 2.2 htc desire HD for testing. curiously on a virtual device it works correctly. maybe you can help me? thanks a alot
June 14, 2011 at 2:05 pm
Um, I haven’t run into this problem but are you sure you are locking the activity to landscape mode?
android:screenOrientation="landscape"June 14, 2011 at 2:12 pm
yes the activity screenOrientation is set to landscape, i did just a little project with just one button and a editview for the result and for sure ur code. because i thought it could be a failure in my project. but also in this mini project i got the same bug. maybe do you have time to have a watch on this project?
June 14, 2011 at 2:28 pm
Can’t promise anything but if you stick it on github I’ll try to take a look as soon as I get some time to spare
July 4, 2011 at 8:51 pm
Surelly I am late, but I also had your problem and I solved it adding the following into the manifest
July 5, 2011 at 8:59 am
Um…what was that you added to the manifest!
July 5, 2011 at 1:04 pm
sorry, don’t know what happened before. This is what I add to the manifest
July 5, 2011 at 1:05 pm
come on, what’s wrong with this s*ht!!! lets see now
supports-screens android:largeScreens=”true”
android:normalScreens=”true”
android:smallScreens=”true”
android:anyDensity=”true”
September 7, 2011 at 9:53 am
I added that to my project manifest, the zxing manifest already had it. Although that did not solve the problem, the scanner is still to the bottom of the screen.
September 7, 2011 at 10:02 am
I found the problem. sorry
September 26, 2011 at 4:14 pm
could u explain what is was wrong, I have the same problem – my preview screen on top of the window
October 19, 2011 at 1:46 pm
check if in android manifest minSdkVersion is set to “8″
July 5, 2011 at 8:37 am
Hi! I tried the integration and it works, thanks
But there’s a problem: “Barcode Scanner” takes control of application name: the application name displayed is “Barcode Scanner”, not the one I provided in my application manifest, I can’t fix it. Any suggestion?
July 5, 2011 at 8:52 am
Doesn’t the barcode scanner go full screen without titlebar?
In any case, if you want to customise, you can go into the src of the Android ZXing app, change stuff there and recompile. I did this to disable many of the menus.
July 5, 2011 at 8:55 am
Yes it does. The problem that I launch Barcode Scanner with a button in my application but including ZXing as library the main app I’m developing gets “Barcode Scanner” as application name. It seems like Barcode Scanner overrides my manifest settings.
Now I try to edit Barcode Scanner manifest a bit. Thanks
July 5, 2011 at 10:14 am
Found the problem: the “values-” folders. I’m Italian and my test device language is Italian.
By default the main app’s app_name overrides the library’s app_name but using locales and not in the main app doesn’t work. I deleted all the “values-” folders in the library and now all works fine.
Now I’m trying to disable menu in the capture view.
February 20, 2012 at 4:21 pm
Good question men… You help me a lot!!! Thanks Oskar
July 6, 2011 at 11:21 am
Hi, I am an absolute noob here. But someone help me out here?
On Step 4, it says I am suppose “Select Zxing” in the library. But when I click on “Add”, there is no option at all, not to mentioned Zxing. Did I do anything wrong? Please help!
Thanks!
Andrew
Thanks!
July 6, 2011 at 12:13 pm
Did you do this step?…
Right-click on ZXing project –> properties –> Android –> Scroll down and check/tick the “Is Library” checkbox –> OK
July 7, 2011 at 8:34 am
Thank’s for your tutorial !! Works Great !!!
July 11, 2011 at 8:29 am
hi! help me please, i did all the three first steps but on step 4 there is no options, what should i do?
July 11, 2011 at 9:24 am
Did you do this at the end of step 3?
“Actually, while we’re here we should do one more very important thing! Right-click on ZXing project –> properties –> Android –> Scroll down and check/tick the “Is Library” checkbox –> OK.”
July 11, 2011 at 9:28 am
yes i did i checked the checkbox as you it ‘is mentioned
July 11, 2011 at 9:44 am
Sounds like an Eclipse problem. Make sure you have the latest ADT tools as here
http://developer.android.com/guide/developing/projects/index.html#LibraryProjects
Also, the minimum platform supported is 1.6 so make sure your project is set to that or higher. Also from memory, Library projects didn’t used to work with projects on level 5 & 6 (Android 2.0 & 2.01) but I can’t find any documentation to support this so maybe its fixed.
March 21, 2013 at 5:05 pm
Buddy can u send the project .Plz its very urgently
July 12, 2011 at 4:25 am
emna, I believe Step 4 is worded incorrectly
The original:
Step 4: Include ZXing Android into your project.
Within Eclipse, Right-click on ZXing project –> properties –>Android –> Scroll down to Libraries section –> Click Add –> Select ZXing (which should appear as an option as a result of completing previous step).
Should read:
Step 4: Include ZXing Android into your project.
Within Eclipse, Right-click on YOURPROJECTNAMEHERE project –> properties –>Android –> Scroll down to Libraries section –> Click Add –> Select ZXing (which should appear as an option as a result of completing previous step).
If you followed the original wording you would be adding library project to itself–which is senseless. Other than that, pretty nicely done… thanks for the help.
July 12, 2011 at 9:41 am
Great spot. Post updated with your change, thanks!
July 14, 2011 at 7:40 am
thank you a lot for your help it’s working for me now
July 14, 2011 at 5:30 am
HI !
Please check this application on github called QRC
https://github.com/egure/diordna/tree/master/QRC
This has the integrated QRC source , you can build application based on this.
Thanks,
Darshan
March 22, 2012 at 4:54 am
The link is broken.
August 29, 2012 at 4:00 am
Is it available somewhere else?
July 14, 2011 at 7:56 am
another question please! when i push the button to start scanning i only got the retangle with the red laser line without a result, i waited… but still nothing. what could be the problem please!
July 14, 2011 at 9:18 am
The scan mode in the post is set to QR code. With this setting it will only scan 2d barcodes
December 9, 2011 at 5:15 am
I have the same problem. I installed the Zxing app (that is being built from the downloaded source codes) into my device. I get the rectangle with the red line, but it just keeps on trying to read the barcode. No matter if it is a 1D or 2D barcode.
Although the Zxing app that is available in android market works perfectly.
Could the android target platform be an issue? I have tried android 2.2 and 2.1 to build this project.
Great tutorial btw.
February 14, 2012 at 7:02 am
I have same issue. Does it have other modes? What are they & how to use them. Can you please provide any tutorial link if any?
September 4, 2012 at 6:21 pm
What idiot must the creators of the lib be to enforce QR mode. What the hell for?
July 14, 2011 at 3:05 pm
First off this is a brilliant article. I have been searching over the net for help with fully integrating the zxing and was able to solve my issues through this.
Now to my wonderful new hurdle:
How to get the product details with the successful scan. I have been looking through the zxing source code and have been trying to impelement the ProductResultHandler ( http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/ProductResultHandler.java ) without success in getting the product info. Any assistance would be greatly appreciated.
July 14, 2011 at 4:31 pm
great tutorial.
I’m going to link it on my blog, I hope you could be happy about that
July 14, 2011 at 4:38 pm
[...] zxing barcode scanner in your Android application Hi there, let me highlight this good tutorial of Damian Flannery about adding barcode scanner capabilities to your Android [...]
July 15, 2011 at 8:45 am
Hi,I have copied and paste in android manifest file…but still getting
run time exception…Please help…
Thanks,
Aditya…
July 15, 2011 at 10:45 am
thanks a lot..this code works wonders..!!!
July 17, 2011 at 11:40 am
Thx for this tutorial, but everytime I build the android Project from existing source (step 3), src and res are full of unresolved variables. Can anyone help?
July 26, 2011 at 12:56 am
I think you should change the API lever . Begin, i use api lever 3 – but some attributes error .So I change the lever to 7 .It’s work .
July 27, 2011 at 2:37 pm
I have the exact same problem, what OS are you using? Have you managed to solve this issue?
February 24, 2012 at 4:06 pm
pls I still have this issue…
what are the specifics to get it working..
zxing version, api level..
Much thanks
July 18, 2011 at 9:35 am
Hi all, I have a problem. I did everything as in tutorial, but still have a problem. I think ZXing project witch I convert to library can’t correctly included to my project. First time when I add ZXing library to my project I see green icon, I ‘ve built project, run on emulator and got “runtime exception”. After I go to properties an see red icon on Properties -> Android -> Library (earlier included)…
Maybe someone can help me ?
This is screenshot of my error – http://imageshack.us/f/19/unledqpk.png/
July 18, 2011 at 10:12 am
Ok no longer need help. I found solution, thx…
August 3, 2011 at 12:04 pm
can u pls tell me the solution
August 11, 2011 at 7:38 pm
Hi! I have the same problem, what was the solution you founded?
August 16, 2011 at 7:47 pm
I solved this problem changing the ZXing directory to the same directory where the workspace is. Before I had the ZXing directory in other unit.
July 18, 2011 at 10:16 am
Hi,
I have follwoed step by step.But getting Run time Error.My manifest is like below….
”
”
Please Help…..want urgently.
July 18, 2011 at 10:18 am
Hi,
I have follwoed step by step.But getting Run time Error.My manifest is like below….
Please Help…..want urgently.
July 18, 2011 at 12:22 pm
When I add ZXing as a library I get like 400 errors.
Lots of things which cannot be resolved to a type like AddressBookParsedResult BarcodeFormat. Hope someone can point me to what im doing wrong.
July 24, 2011 at 3:35 pm
Great article, thanks!
I’m having a little trouble following, though. So I have the whole zxing project, and I’ve been able to build the core.jar using ant.
In Eclipse, when I create the new project, it wants to default to android 2.3.1. I want it to use 2.2, since my phone doesn’t have 2.3 yet and I’d like to try this out on it. I can import the core.jar and have it build with 2.3.1, but if I try to change the project to 2.2, I get an error in my manifest with it not liking the xLargeScreens attribute, then all kinds of other errors pop up and it all goes to hell.
Is it because the core is built for 2.3.1 as well? How do I make that build for 2.2?
Also – if I create my own project and try to add in my CaptureActivity project (using 2.3.1 – just trying to see if i can get a full build going), it adds the CaptureActivity_src and then I get all these errors unless I also add core.jar to my project.
I’m doing this on a mac with eclipse 3.6 and all the up to date android stuff.
Thanks!
July 26, 2011 at 12:52 am
Thank you so much,this tutor help me a lot .
July 27, 2011 at 1:25 am
I’m trying to follow your tutorial. Currently I can add the ZXing project as a library to another project, when I make it the first time I see a tick icon under the reference column, but after I close this window and check properties again I see a red X, I don’t understand what can be wrong, perhaps Eclipse? I’m using Eclipse 3.6.2 and I can build the app but when I try to actually scan it crashes I believe it has something to do with this reference, I would appreciate any help you can provide me with, thanks in advance and great tutorial.
July 27, 2011 at 4:37 am
Are you using Linux or Mac? I can’t find a way to make this work finally I solved the red X issue, now I always see a green tick the reason was that the projects were located in different partitions.
Now the problem I have is the ‘library project’ I’ve added the core.jar file (I’ve built it lots of times always getting a success message), but somehow it doesn’t work I get errors (tons of them) in the source files, I suppose those errors should disappear when the file (core.jar) is added to the project, but for me it doesn’t work (it’s frustrating) I’ve already added it many times as an external jar.
Hope you can help me I’m using Win 7 x64 and Eclipse 3.7.0. Thanks in advance for your help.
July 27, 2011 at 9:33 pm
I solved the issue I set the library project profile to android 2.2 and that made it work. Of course the core.jar file was added as an external jar.
August 14, 2011 at 3:47 pm
Hi,
I tried what you said, and it makes the compiling errors in the library go away, but when I launch the activity it gives me a message: “Sorry the Android camera encountered a problem. You may need to restart the device.”
August 16, 2011 at 8:32 pm
I followed all the steps and finally I can use the Barcode Scanner with my application but just if the Barcode Scanner is installed or if I used the debbuger of Eclipse (which installs the Barcode Scanner App from the library created on the step 3). My question is: How can I fully integrate the Barcode Scanner code into my application without install it and with no trace of the original Barcode Scanner? I think is weird for the user that my app installs another app in the device, and I’m not sure if I’m doing something wrong.
Thanks.
August 28, 2011 at 7:15 pm
Amazing tutorial, works perfectly!
I have only one question, if I press the “CAMERA SCAN” button my phone (that has Barcode Scanner APP installed) asks me:
“complete action using”
- BARCODE SCANNER
- MY APP
Is there a way to specify in the intent not to show the “complete action” dialog? and just start MY APP as default?
thanks
August 28, 2011 at 7:31 pm
Thanks.
You need to change the action intent (in the zxing that’s included in your app) to something custom.
e.g. Change public static final String ACTION = “com.google.zxing.client.android.SCAN”; to String ACTION = “com.yourco.yourproject.android.SCAN”; in com.google.zxing.client.android.Intents.java (in ZXing project)
and change to in the AndroidManifest for the ZXing project.
Then Recompile. That should do it.
September 15, 2011 at 12:48 am
Thank you works great
October 19, 2011 at 10:00 pm
Would you be able to post what your two manifests look like for this? I cannot for the life of me get this to work. I keep getting
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=net.blueearth.clowns.android.SCAN (has extras) }
Thanks!
August 29, 2011 at 12:04 pm
Hi,
Actually I followed this tutorial line by line but integrated zxing to my own project but when button clicked the scanning is not performed please correct my problem
August 29, 2011 at 12:06 pm
Hi,
Thanks for providing this tutorial, I have followed this tutorial line by line everything works fine .But while integrating with my app I found problem. Scanning is not done when button is clicked
August 31, 2011 at 9:12 pm
I tried to import this project. After successfully creating core.jar and loading the android project – i get tons of errors related to strings.xml.
Use %s as a placeholder for the product ID, and %f for format
I get
error: Multiple substitutions specified in non-positional format; did you mean to add the formatted=”false” attribute? strings.xml /qrcodeprj/res/values line 96 Android AAPT Problem
September 8, 2011 at 6:53 am
I received a similar error too. Downloaded fresh copy of the android project from zxing project and the errors were resolved.
September 9, 2011 at 5:31 pm
Hey guys!
I did everything (get the source, compile with Ant, get the core.jar to my project and include the zxing project as an Android Library on my App) and… sweet! Got the scanner to work (even without asking me what App to use) and after scanning, it returns to my App.
BUT… it gets back to my own Activity and I try to get the results on the onActivityResult method, resultCode is always RESULT_CANCELED and the intent is null, so no results!
I call the CaptureActivity (on my manifest) with:
Intent intent = new Intent(“com.myapp.SCAN”);
intent.setPackage(“com.myapp”);
intent.putExtra(“SCAN_MODE”, “PRODUCT_MODE”);
intent.putExtra(“SCAN_WIDTH”, 800);
intent.putExtra(“SCAN_HEIGHT”, 200);
startActivityForResult(intent, 0);
In my Manifest I added the CaptureActivity like this:
This is how I’m trying to read the results:
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
Log.d(LOG_TAG, “onActivityResult was reached!”);
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
// Successful scan
Log.d(LOG_TAG, “Barcode Scanner successful.”); } else if (resultCode == RESULT_CANCELED) {
// Handle cancel
Log.d(LOG_TAG, “Barcode Scanner canceled.”);
}
}
}
I’ll appreciate a lot if you give me some light about this guys!
Thanks in advance!
September 23, 2011 at 9:34 am
Hi Raczo,
I am also getting the same issue as of yours ..did you find any solution to this .If you can please tell me .
September 15, 2011 at 12:46 am
I all, it works perfectly thanks!
I also had to add the core.jar to my project (not just to the ZXing project). Hope this will save some time to somebody!
Thanks again
September 21, 2011 at 9:29 am
Thanks, I forgot to add this step. Post updated. Cheers.
February 22, 2012 at 7:28 am
please help me out my app is able to scan qr code but it does not redirects me to the result it only says “found url” and returns back on main page, how to solve this problem please help me out can you please share your working sample project on my id sudhirmalik2011@gmail.com i’ll appreciate your kindness.
September 4, 2012 at 6:02 pm
You need to edit Intents.java and change public static final String ACTION to the action name for ScanActivity in your app manigest.
September 19, 2011 at 3:17 am
Hi Damian,
This is a great post, it helped me a lot in getting a scanning app up and running.
Thank you.
Grtz
September 21, 2011 at 8:48 am
Many thanks for pulling this together. It’s a great jumpstart into integrating the scanning activity into my app.
I also needed to add the core.jar (see @marco) to my new project to eliminate errors resulting from adding my Zxing project library. Does this mean that something in my build process or path could be incorrect?
For those attempting to run on 2.2SDK / API 8:
Building on Android SDK 2.2 / API 8 required modification of the AndroidManifest.xml file, removing:
‘android:xlargeScreens=”true” ‘ from .
The issue was discussed on the Zxing project site (read to the bottom): http://code.google.com/p/zxing/issues/detail?id=864.
Thanks,
Mark
September 21, 2011 at 9:29 am
Thanks, just updated the post to reflect this needed extra step.
Regards,
Damian
March 3, 2012 at 7:14 pm
You sir, are a genius. Thank you for this solution, I was hoping that someone in the comments had a solution to this.
September 21, 2011 at 8:51 am
Regarding comment from markosys:
‘android:xlargeScreens=”true” ‘ from .
should read
‘android:xlargeScreens=”true” ‘ from .
regrets for the typo/omission.
September 22, 2011 at 7:14 pm
I did everything (get the source, compile with Ant, get the core.jar to my project and include the zxing project as an Android Library on my App) Got the scanner to work (even without asking me what App to use) and after scanning, it returns to my App…Help needed ..whats going wrong ..can you tell me.
September 23, 2011 at 9:43 am
I did everything as you have shown, when I call the barcode intent, the scanning screen appears but instead of the camera screen it appears white background in the scanning box(which has a red line), but it scans the barcode when i point my phone to a code.
September 24, 2011 at 12:50 am
Sorry, but this is not “Native”, this is using intents. Natively would be using the core directly in your code.
September 27, 2011 at 3:30 pm
Well if you followed the article then you just compiled the src and linked it to your project; so you can either hook into your own view or call the scan function via an intent.
The term native in this context is used to illustrate that you don’t need to install the barcode scanning app separately.
September 27, 2011 at 3:03 pm
It still requires the barcode app, isnt there a way to fully integrate the code without having to rely on the user to install the Barcode scanner app?
September 27, 2011 at 3:06 pm
Um, it doesn’t require you to install the app separately. That’s the whole point. You must be doing something wrong.
September 27, 2011 at 7:20 pm
That is very strange, there are two “errors” I get, one just loops me back when I press the button, it sends me back to the classical layout, and sometimes it crashes because apparently “No activity found to handle intent”, and when I install the scanner it suddenly works. Do you have a .zip maybe of the project? I really dont know what Ive been doing wrong..I followed the tutorial to the letter (also tried bringing in the source into the project but I still get that “no activity found to handle intent”.
thanks
October 2, 2011 at 10:53 pm
Thank you so much for this awesome post! I have searched for hours for the answers. After reading through your post, I realize that I was only hitting pieces of steps previously, but now the whole picture makes sense. Thanks again!
October 3, 2011 at 9:03 pm
Great article!
Thanks from Mexico!
For those having problems…remember that, when you create your Android project, you must specify a platform version – according to this version some AndroidManifest.xml tags will change. So, until you fix your AndroidManifest.xml you will see a lot of errors about the R class.
October 3, 2011 at 10:16 pm
One more thing to note is that this article as posted, will only be capable to recognize QR Codes…
If you want your APP to recognize a wider variety of codes, remove this line:
intent.putExtra(“SCAN_MODE”, “QR_CODE_MODE”);
This worked for me very well.
ZXing developers tell that, if you are interested in getting product bar codes, you can set this:
intent.putExtra(“SCAN_MODE”, “PRODUCT_MODE”);
More info here:
http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/Intents.java
And, of course in the main project page:
http://code.google.com/p/zxing/wiki/ScanningViaIntent
Again, thanks for this great article.
October 27, 2011 at 11:52 pm
Very thanks for this tips, now classic bar code are detected.
October 5, 2011 at 10:40 pm
Hey Damian nice tutorial, but i guess i have a problem i follow everything that you order nevertheless i have a problem in the last step that says: “EDIT: You need to do yet one more thing! You need to add the core.jar (produced in Step two) to your new project (Right-click your project –> Properties –> Java Build Path –> Add JARS… –> Select core.jar –> OK). Thanks to Marco and Markosys in the comments for spotting and pointing out the omission! ”
but i cant find a way to find the core what i just see are the projects, and the project that i import the core.jar dont have this file to select.
Here is a printscreen maybe this help you to understand what im trying to say
http://img703.imageshack.us/img703/7075/errorpus.png
Sorry for poor english but im brazillian and my english isnt too good.
October 6, 2011 at 2:49 pm
It should say – ‘Add external Jars’. Then you can navigate and select the core.jar that you built in step 2. Post updated.
October 7, 2011 at 9:43 am
Hi…thnx up till now…but m stuck in different kind of problem…actually m following all the steps..But when i build Core folder and look into it firstl i didnot find core.java.then is run command again.this time there was core.java but there is no manifest file.So,eclipe is not allowing to built project without manifest.But should i do?
October 7, 2011 at 9:50 am
m sorry for the poor english.It was actually core.jar..not core.java.
October 11, 2011 at 8:44 am
Hi all, I’m one of the developers of Barcode Scanner. This is no doubt helpful, and the spirit is in the right place.
However I must say we discourage people from copying-and-pasting Barcode Scanner in this way. You’re encouraging people to create apps that make people think they’re using our app, when they’re not.
I gets worse when people do this, then modify the code in ways that break it. Guess who gets the e-mail for support? We also see plenty of people just do this to add ads or affiliate links.
The motivation seems to just be “because I don’t want to make people install someone else’s app”, which is a flimsy reason. It may increase profits for the app maker, but to the extent it does, it subtracts a little from the open-source community. It also harms the user experience IMHO; the user is not getting fixes and improvements of the real Barcode Scanner app this way. Finally, you can see how much programmer time it’s wasting to try to get the integration working, when Intents takes 5 minutes.
I won’t suggest you should remove this post of course; I would request that you consider the downsides of this approach, the negative externalities on the project, and perhaps emphasize that in the text.
October 11, 2011 at 9:34 am
Thanks for your comment Sean, I completely agree with everything you outlined. I’ve updated the text at the top of the article; hopefully to your satisfaction. I’d like to leave the article up because I think it has saved people a lot of time. However, if you feel it’s being overwhelmingly used for the wrong reasons and is harming the open-source project then I’ll take it down because that’s the last thing I want to do.
Best regards,
Damian
October 11, 2011 at 10:19 am
Thanks Damian, that’s a great reply. Let’s leave it there. I’d rather people have all the info they could want, and also all the issues to consider, and this helps that goal. Thanks.
October 18, 2011 at 2:52 pm
Then why not have the BarcodeScanner app installed by default on your phone, with the Android OS distribution? If it is not used by other apps, and it is not there by default, I do not see a reason why we should ask users to install “yet another app”. This is really poor user experience, and it will just make people walk away from such apps.
October 18, 2011 at 2:58 pm
Why not have it baked into Android itself? Well, I’m afraid I’m not that decision-maker! What do you mean? (As it happens — this was developed at Google and was almost a part of Android 1.0, but wasn’t, and probably should not be. But, this could easily be an app that’s nothing to do with Google.)
It *is* used by other apps. It is preinstalled on some phones, but not most. Again — hardly something the app controls.
I don’t think it’s such a big deal to install another app. I don’t argue with people who think it’s a bad experience. I’ve open sourced all this code to help you build it into your app. I’m merely emphasizing the “you build” and “your app” — I’m speaking out against pure copy-and-paste jobs out there which have little added value.
Sure, it’s easier for them. Sure integrating makes the “experience better”. It may make them more money. These are still no justification for directly ripping off someone’s work.
October 20, 2011 at 12:51 pm
Sean, I understand your point, am very grateful for very good library you implemented and by no means do I want to rip it off. I am, however, going to say that to the non-technical user it makes a great difference if he is asked to install another app or not. Apart from that, there are other reasons why I need to integrate the ZXing library directly in my app. I want to use ZXing to transfer sensitive bits of data, such as public/private keys, which I really do not want to leave my app (especially not to an app that has Internet permissions and can be updated remotely). Also, for the sake of good user experience, I would like to change the screen that displays the QR code to give the user customized instructions, instead of displaying the content of the barcode (which is all a big junk of gibberish that makes no sense to the user).
That being said, one think I am totally missing out on by basically ripping your code apart, is the great updates you will be releasing to improve the performance of the decoder. For this purpose, do you think you could release a distribution that would be easy to incorporate in an app (for example a jar file with the library for Android).
Thank you very much. I really appreciate your work and your help.
Best,
Iulia
November 16, 2011 at 6:13 am
Hi Sean!
Indeed, your words are very true.
I have just convinced my boss to let users download Zxing, Barcode Scanner; and through the Android Intent Integrator, the whole picture looks much more stable and trustful.
I hope other CEO’s are able to be convinced.
November 16, 2011 at 4:24 pm
Thank you — also note that I recently updated and improved IntentIntegrator. You should look at the latest version in Subversion.
November 22, 2011 at 11:31 pm
Great!
Thanks for coding such a great tool!
February 13, 2012 at 6:27 am
Hi Sean, thanks for the great code but I found this page when trying to find how to integrate zxing with my app. You have said that using Intents takes 5 minutes to integrate but I can’t find a clear explanation of how to do this.
It would be helpful to me (and I’m sure others) if you could provide a link to the ‘right’ way to integrate using intents.
Thank you
March 13, 2012 at 8:18 pm
Hi Sean,
I appreciate your input here. I’ve decided that it is a better idea to allow the user to manage updating of the zxing code through the market so that we as developers of other apps don’t have to mess with that. However this is still the only tutorial that I have found on the web that actually shows how to launch the scan activity using intent in the EclipseDE.
My main issue here is that I’ve looked through the IntentIntegrator and would like to use it in my code but I can’t seem to find any resource out there using the keywords that I have in my vocabulary to actually figure out how to import the IntentIntegrator in my Activity in order to utilize it without adding zxing as a library in Eclipse.
Any guidance would be greatly appreciated.
Thank you,
-Neil
March 13, 2012 at 8:23 pm
Just copy the IntentIntegrator and IntentResult source files into your project and you should be good to go.
March 13, 2012 at 8:23 pm
The simplest thing is to just copy the source code. Or, build a jar from the project by typing ‘ant’ in android-integration and add that as a library jar. Couldn’t be easier.
October 18, 2011 at 4:34 am
[...] /android project as a library in your own project. Damian Flannery has put together a very nice step-by-step blog post for doing [...]
October 18, 2011 at 2:48 pm
Thank you very much for the explanation on how to get this done. This was very useful. Especially since the process is so counter-intuitive. One thing I totally disagree with you on: It is a really BIG deal asking users to install another application just so that they can install yours. People are lazy, things are too complicated, and they cannot spend their time installing apps, so easily integrating the barcode scanner into your app, is totally worth it.
October 18, 2011 at 3:20 pm
Hey Damian,
I actually set up the same project structure independently of your post and I’m seeing an odd issue when I install my application on my phone. I end up getting two icons, one launches my app and the other launches the original barcode scanner. Have you ever seen anything like that in your experience?
Thanks…
Simon
October 18, 2011 at 3:36 pm
It means you haven’t taken out our CaptureActivity from your copy of the manifest. You should probably start with your own manifest. If you copy ours (aside from issues here) you’re going to get settings and such that don’t apply to you.
October 21, 2011 at 1:25 am
Hmm well I seem to have got it working… but for some reason the mask outside of the border is red rather than just a transparent black (making it look like half of the screen is just red). Any idea why this might be happening? Thanks.
October 21, 2011 at 12:53 pm
nevermind got it fixed.
October 22, 2011 at 1:05 pm
Thanks for the great instructions. However, I am having an issue using ZXing as a library. Every time I attach it in Eclipse it looks fine (little green tick). However, when I then check that it is still included, it has changed to a red cross and the Project name is simply listed as a question mark.
I have tried many different API levels, rebuilding etc, but nothing seems to work.
Any suggestions about how to fix this would be much appreciated.
October 22, 2011 at 7:31 pm
I managed to get past this problem by deleting the minimum SDK levels listed in the ZXing manifest.
Now I get a fatal error running it which states:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN (has extras) }
I can remove this by separately installing Barcode Scanner, but as soon as I uninstall it, the error returns. Obviously it isn’t actually loading the ZXing or Core jar…. even though both are listed properly under ‘Library Projects’ and ‘Referenced Libraries’.
Any ideas would be welcome because this is driving me nuts now! Thanks.
October 28, 2011 at 12:03 pm
Had the same problem. My problem was in my manifest. Where I forgot to put the inside the tags
From there, it worked like a charm.
Else ensure that you have copied it, excatly as in the post.
Try renameing it to your own:
something.someting.android.SCAN (in Activity)
and similar in the Manifest
and in the class Intents.java in ZXing project
November 20, 2011 at 9:28 pm
Jakob, I’m having this problem as well. Can you explain your comment about forgetting to put something inside the tags?
December 18, 2012 at 11:42 am
Hi there..
Jakob can you please explain your comment, I am desperate for the solution
October 27, 2011 at 10:31 am
hi this is wonderful ,
but i want to impliment in my application a sample scan code bar.
that is to say, win i want i scan a code a bar, it will store in imageview (same application fidme)
please can you help me.
October 28, 2011 at 11:54 am
Everything works! Except I have problems when I access the menu in Barcode Scanner. Menu shows, but when I select a menu item (Help) I get:
java.lang.NoSuchFieldError: com.google.zxing.client.android.R$id.help_contents
I also have problems when clicking on preferences (but found a work-around for that)
Help
November 5, 2011 at 7:34 pm
I have problem with creating the core.jar ,plase he;p me.thank in advance
November 14, 2011 at 1:06 pm
Dear damian flannery,
Please help me with the basics. I installed ant. My zxing is in c:\zxing. When I open command prompt on windows 7,
I type in:
>C:\zxing
>’C:\zxing is not recognized as internal or external command,operable program or batch file.
So I don’t even get past the second step. can you please help me with the command line statements
November 14, 2011 at 10:28 pm
Problem solved. I have embedded zxing in my application, can I test it with the webcam on my laptop?
November 15, 2011 at 6:05 am
i am facing an error java.lang.VerifyError in while starting CaptureActivity
November 17, 2011 at 7:18 am
I am also having the same issue…
November 18, 2011 at 6:25 pm
I’ll try this out. Thanks a lot for this valuable write up.
I have 2 queries:
1. Do I have to write the camera code for Zxing to be used? Or will it automatically invoke the camera functionality?
2. If I want the scanned result to be from my sqlite db how can I achieve it?
November 19, 2011 at 6:28 pm
Can you please give the core.jar, I couldn’t able to make it .. Thnaks
November 20, 2011 at 8:52 pm
Note that ADT v.14 no longer allows resource fields (R. etc.) to be constants in library projects. This means they can’t be used in case statements. So once you clean up the manifest (xlargeScreen item noted above) you will have to go through and find the 3-4 case statements (highlighted by errors) and convert them. The fix suggestion in the gutter of the code indicated how to use Eclipse’s QuickFix feature to auto-convert these Switch statements to if-else.
December 5, 2011 at 5:44 am
Hi, Thanks for nice tutorial. I implemented this Zxing code scanner in my application. everything working fine. but i got extra icons i.e, 3 icons in left top, right top and bottom right. what’s these icons? is there any help and i would like keep my own button i.e., close button. if i clicked on close button the current activity will close and goes to previous activity. can any one tell how to achieve this problem?? this is my mail is s.seshu143attherategmaildotcom..
Thanks in advance………………
December 6, 2011 at 9:29 pm
I’ve modified the ZXing source code to make encoding/decoding a bit easier. The project is located at:
http://code.google.com/p/android-quick-response-code/
The new source allows direct integration of encoding and decoding without having to install ZXing or use Intents.
December 6, 2011 at 10:38 pm
I think this is overall a positive step — solving several of the issues that I perceive that rampant copying-and-pasting of Barcode Scanner has caused. Justin I will follow up with you directly with one small request.
May 16, 2012 at 3:02 pm
Hi,
I checked the link and it looks easier to implement
instead of using zxing as a library.
where can I download this?
I went to your download page and only saw png files.
http://code.google.com/p/android-quick-response-code/downloads/list
May 21, 2012 at 8:40 pm
Don’t check the download page, using the SVN code located in the Source tab.
http://code.google.com/p/android-quick-response-code/source/checkout
December 9, 2011 at 4:13 am
i do step by step but it do not work, an excception was found in logcat: unable to start com.google.zxing.client.android.CaptureActivity
please hepl me !!!
May 21, 2012 at 2:22 pm
Hi I’m having the same problem, did you find a solution?
December 9, 2011 at 6:08 am
Hi all, i tried with this procedure and always get error. finally i found tutorial with call zxing via intent with barcode scanner app must install in phone. i can call barcode intent but my phone always get error after scan the barcode, what procedure or what kind off setup must i do. this is my code :
public class zxing_act extends Activity {
/** Called when the activity is first created. */
private EditText edittext1, editText2;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
EditText edittext1 = (EditText) findViewById(R.id.edittext1);
EditText editText2 = (EditText) findViewById(R.id.editText2);
Button next = (Button) findViewById(R.id.button1);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(“com.google.zxing.client.android.SCAN”);
intent.putExtra(“SCAN_MODE”, “QR_CODE_MODE”);
startActivityForResult(intent, 0);
}
});
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra(“SCAN_RESULT”);
edittext1.setText(contents);
String format = intent.getStringExtra(“SCAN_RESULT_FORMAT”);
editText2.setText(format);
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}
sory my english is very poor.
December 14, 2011 at 5:13 am
Try my blog on this, may help.
http://mcondev.wordpress.com/2011/06/24/zxing-1-7-for-android-on-eclipse/
December 22, 2011 at 6:37 am
Can some one upload the core.jar file pls.
December 27, 2011 at 10:11 am
very useful , covered evry detail thanku
December 27, 2011 at 10:13 am
One important point , the core file has to be added to library of the new project as well.
December 28, 2011 at 1:55 pm
Is your app running with ZXing app?
December 28, 2011 at 10:23 am
I am able to launch ZXing App from my native App,thats fine,when I launch,it is able to scan but not Showing any details of it like Url,name or address..Plz suggest me with some solutions
January 3, 2012 at 8:01 pm
please some one help me out via this … i tried each and every thing to make my app run but it shows lot’s of error’s … someone plz help me out … plz drop email at sudhirmalik2011@gmail.com if you can solve my prob … i need to scan qr code with my app only
January 6, 2012 at 10:30 pm
Thanks a lot Damian, it really helped.. had to jump through a few hoops.. one thing I would like to mention is that.. the ZXing project and the project that includes it as a library should be in the same drive and accessible via logical path ..
Sean Owen.. I understand your argument but one of the challenges I see while making an application is that users would frown on the need to install another application to make a main application work.. for people who have a scanner installed well and good.. but others would not freely go ahead and install it. I sure do understand the cost component and also understand the work that you and your team have put it.. it would be awesome if there was some standard way to integrate ZXing directly without having BarcodeScanner installed as an application which would help you and also adhere to the means you expected the product to be used..
FYI I am not a Android JAVA guru.. I understand and have worked in many programming languages and starting to wade into the Android Space..
January 10, 2012 at 8:28 am
I have a major problem when using the integration on 3.0 and 3.1 (But not 3.2)
In 3.0 and 3.1 the search rectangle is moved to the lover left corner and scanning is really bad! I found out that the barcode still gets recognized if it is in the center of the viewfinderview. (But the user experience is really bad)
Have any one else experienced this problem? Help!
January 10, 2012 at 9:10 am
Guys please use https://groups.google.com/forum/#!forum/zxing for project / app support, not here. (But yes this is a known issue that was already fixed for some devices.)
January 10, 2012 at 9:23 am
Oh sorry. Didn’t know that
January 11, 2012 at 11:29 am
HI All,
I followed all the steps as mentioned but I am getting the following exception at run time
01-11 11:21:48.411: E/AndroidRuntime(18807): FATAL EXCEPTION: main
01-11 11:21:48.411: E/AndroidRuntime(18807): java.lang.ExceptionInInitializerError
01-11 11:21:48.411: E/AndroidRuntime(18807): at java.lang.Class.newInstanceImpl(Native Method)
01-11 11:21:48.411: E/AndroidRuntime(18807): at java.lang.Class.newInstance(Class.java:1429)
01-11 11:21:48.411: E/AndroidRuntime(18807): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
01-11 11:21:48.411: E/AndroidRuntime(18807): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
01-11 11:21:48.411: E/AndroidRuntime(18807): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-11 11:21:48.411: E/AndroidRuntime(18807): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-11 11:21:48.411: E/AndroidRuntime(18807): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-11 11:21:48.411: E/AndroidRuntime(18807): at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 11:21:48.411: E/AndroidRuntime(18807): at android.os.Looper.loop(Looper.java:123)
01-11 11:21:48.411: E/AndroidRuntime(18807): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-11 11:21:48.411: E/AndroidRuntime(18807): at java.lang.reflect.Method.invokeNative(Native Method)
01-11 11:21:48.411: E/AndroidRuntime(18807): at java.lang.reflect.Method.invoke(Method.java:521)
01-11 11:21:48.411: E/AndroidRuntime(18807): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
01-11 11:21:48.411: E/AndroidRuntime(18807): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-11 11:21:48.411: E/AndroidRuntime(18807): at dalvik.system.NativeStart.main(Native Method)
01-11 11:21:48.411: E/AndroidRuntime(18807): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
01-11 11:21:48.411: E/AndroidRuntime(18807): at com.google.zxing.client.android.CaptureActivity.(CaptureActivity.java:106)
01-11 11:21:48.411: E/AndroidRuntime(18807): … 15 more
Can any please help me I am really new to this and android as well..
Nikhil
February 13, 2012 at 10:28 am
Hey Nikhil,
I am having the same problem. Can you help me out if you figured out whats wrong??
February 23, 2012 at 1:45 pm
Happened to me while using eclipse.
I fixed this problem by compiling the core.jar library using ant and including it into the client project. Setting up project dependancy does not work.
September 6, 2012 at 10:03 am
Take a look at http://stackoverflow.com/questions/9889737/updating-sdk-got-noclassdeffounderror-for-zxing
January 19, 2012 at 5:59 pm
I am having issues with these steps. I cannot even get past step 2. what file do I actually download? There are three options…how do I install it?
January 25, 2012 at 6:57 am
hi thanks for the post i have one doubt what if want to use this library in my app i have to pay money for them
January 25, 2012 at 10:54 am
I am novice here please help me, I have done all steps and code compiles well but when I press a button to start the SCAN activity nothing happens, my current activity just reloads (showing me the same button). the code defines intent and starts activity but
it never goes to “onActivityResult” method. Does anyone have a solution for this?
February 22, 2012 at 7:05 am
can you please tell me Ali if you solved your issue how did u figured that out i am having same issue as you were having please help
February 24, 2012 at 6:04 pm
Have you guys fixed the errors..?
can’t seem to find the source of the problem in mine..
January 25, 2012 at 11:36 am
[...] I completely agree with this. There are many advantages to using the intent based approach as outlined in his comments. My motivation is for an enterprise app that does not have access to the Android market and involves my client installing zxing manually on thousands of devices before they are able to distribute to its business customers. Integrate zxing barcode scanner into your Android app natively using Eclipse « Damian Flannery's Bl… [...]
January 27, 2012 at 3:08 am
If you want to achieve TRUE NATIVE integration of zxing (i.e. not using Intents) then you need only import the core.jar file as a Library into your project and then start using it. To cover a LOT of ground faster you can bring the ZXing App’s code (i.e. zxing/android/src/) but you will need to copy some of the resources from ZXing App’s res/ to your own project’s /res. Then you can go about cutting out the crap you don’t need such as, in my case: Book reader, Menus, History Manager, Google Shopping, Intent handling, most of the *ResultHandlers (AddressBook, Email, Geo, ISBN, Calendar, SMS, Tel, Wifi, perhaps more). And then go on to customise where you need.
January 27, 2012 at 9:28 am
Please don’t encourage people to copy android/. We have enough problems with total copy and paste jobs already. This is officially quite discouraged.
January 27, 2012 at 10:36 am
Is it not well written code? Is it not open-sourced under the Apache License 2.0? Would you have me do something else with the code, other than use it as a baseline to enhance, to somehow fulfil my needs? I don’t understand your angle on this, other than the potential to profit via sales of your paid App (which is unreasonable, given the code is open-sourced). Talk about subtracting from the open-source community
January 27, 2012 at 10:52 am
This has been covered many times. How would Firefox devs feel if you pasted their code into your app and called it “LindoBrowser”? Not illegal, but does not seem ethical.
I’m sure you’re one of the good guys, and not one of the many people out there who publish clones on Market, so that they can add their brand name, or add money-making ads and affiliate links, or worse. That’s really what I’m speaking out about.
I do think it subtracts from the community when you tell people to not use the existing app, and instead copy and paste the code so that you don’t drive any users to the existing app. That’s what you are helping people do here, but I think reasonable people can disagree about whether that’s so bad. To be sure, a lot of people are doing this from companies who want to copy and paste into their app to increase their own profits.
I’d also ask you to ask yourself who you think gets the support e-mail when something that looks a load like Barcode Scanner, but isn’t, has an error? Again: coming out of the community’s “pocket”, which is mostly mine.
If you are encouraging innovation based on this code, I’m all for that. But I doubt that starts with copying all the code. I’d sure like to see someone build substantially their own, better app.
I can’t understand your point about profit. I don’t sell an SDK. Maybe you don’t know that I am the primary developer? I have given four years of time to the open source project, for free. App revenue pays for even more work on the project now, but I still ‘lose money’. Have a look at what I put in here: http://code.google.com/p/zxing/source/list
If I wanted more money, I’d do contract work or something and not spend any more time on the project. Now, what exactly have you given to the people here?
January 27, 2012 at 11:17 am
I guess, like you, I’ve provided a solution of sorts and now I’m here, like you, rambling on
You make gross misjudments about what I’ve done, what I’m doing, and why I’m doing it. Understandable, since you don’t know. But it’d be a shame if you act this way towards everyone that seeks to utilise the core natively.
If I can provide some constructive feedback that may alleviate the need to base off /android/ App’s code: the project lacks documentation and examples (apart from the /android/ App) as to how to utilise the core at all, let alone best practices. Hence why I ended up at this thread, only to find its just using the Intent method (the method described in this thread is more ‘bundled’ than ‘native’).
Bait: Is Indian Giving “ethical”? Is complaining about not making a profit from your contribution to open-source work a very strange thing to do?
Your time and effort is appreciated, at least, by me.
January 27, 2012 at 11:34 am
I don’t know what you’re doing and don’t judge it. I bet you are a force for good. I just said I don’t want to encourage people to go this road; this advice can be used for good, but judging from questions on StackOverflow and the mailing list, 80+% of people just want a quick, free solution for their own company, and don’t want to give back or have any connection to the open source project. So most consumers of this advice are just being helped to do something I don’t support, so I think it’s OK to say I don’t want it supported.
android/ is not an API or library and so is not documented to be used like that. That is why there aren’t “examples”. It’s not meant to be obtuse, and I think it’s clean and reasonably documented. More docs are welcome.
Where I am complaining about not profiting? I was just defending against the implication that I am motivated by money now, by pointing out that I hardly profit.
We were paid handsomely by Google for the initial work. After Google, I continued to support it gratis, with what little time I could sparse. The paid app is an effort to justify sparing a bit more time, since there is much that could be done; improvements are back-ported regularly, not kept to myself. (Really: I was interested to see how a paid app / open source commercialization works on a small scale.)
Listen if you want to get indignant about somebody here, I’d point you to Big In Japan / ShopSavvy. It’s a lovely app and service. But they sell an “SDK” which is mostly zxing inside. They modified the scanner to send back parts of everything you scan to their servers. They track your location and are most certainly out for profit. They had to be told several times to get the open source licensing right. They have never contributed anything to the project. The most ‘thanks’ the project got were bizarre legal threats (http://osdir.com/ml/zxing/2010-10/msg00196.html) which didn’t stop until Google legal got involved.
Really. I am not the guy you want to come after.
January 27, 2012 at 12:34 pm
Don’t worry, your code is in good hands (in this case!).
Really stinks what Big In japan / ShopSavvy did, vultures :/ All the more reason to outdo them via open-source, eh?
January 27, 2012 at 3:33 pm
Friends… what could be wrong when I get errors like this
Description Resource Path Location Type
The method call() of type KillerCallable must override a superclass method KillerCallable.java /ZXing/src/com/google/zxing/client/android/result/supplement line 38 Java Problem
?
January 31, 2012 at 8:08 am
Solved…
Project properties -> Java Compiler -> Compiler compliance level -> set to 1.6 or above
January 28, 2012 at 5:55 pm
I have followed the exact steps and I get a lot of errors but they all have the same concept which is R cannot be resolved to a variable.
How could I fix this, any help would be appreciated
Thanks in Advance
February 9, 2012 at 6:28 am
same issue
January 30, 2012 at 2:22 pm
thanks man! You’ve just saved my life!
February 16, 2012 at 4:11 am
Hii i was getting error wen i created apk file and tried to install plz can u give me code where u have successfully done decoding part….
can u just upload ur that project for me
Thanks in advance..
February 21, 2012 at 5:27 pm
can you please email me your working project sample of Qr Code scanner please on my id sudhirmalik2011@gmail.com
February 7, 2012 at 12:20 pm
Please, I trying and don’t have errors, but the app doesn’t works, it just stay the same, can someone, please send me a example project sucessfull working ? A simple project with a button calling the zxing, PLEASE !!!!
Thanks
February 21, 2012 at 5:22 pm
i have done all the above things and made my own project but when i run my app on phone and scans the QR code it only says “Found URL” and does not redirects me to that URL and takes me back to same page to scan qr code again and again same happens, how can i solve this problem ?
February 13, 2012 at 4:46 pm
Thanks for posting this. It was really helpful. But I’m having a problem when the QR Scanner screen with the red laser line is launched. The scanner appears in the right corner and not in the middle of the screen.any help is appreciated. thanks in advance
February 16, 2012 at 4:09 am
Hii i was getting error wen i created apk file and tried to install that can u give me code where have successfully done….
can u just upload ur that project for me
Thanks in advance..
February 16, 2012 at 8:33 am
hi i have a doubt if i want to display the qrcode image in the same layout where i have entered the string then how can i achieve that one any suggestions will be great help
February 22, 2012 at 6:52 am
as per i have researched you can’t get the image of qr code scanned but i think u can get the result on the same layout …. play with some code under the result section of your activity and you will be able to do that …
February 22, 2012 at 7:20 am
or you can view this also http://code.google.com/p/android-quick-response-code/ …. i don’t know if you will be able to get the qr image on same layout … just try ….
February 22, 2012 at 7:21 am
or you can view this also http://code.google.com/p/android-quick-response-code/ …. i don’t know if you will be able to get the qr image on same layout … just try ….
February 23, 2012 at 3:57 am
Thanks.. man it worked for me
February 24, 2012 at 6:43 am
Can’t build the zxing successfullly… somebody tip me off..
When I add the import i get the error “manifest file missing” … should be pretty easy to fix..but…
help..please.
February 28, 2012 at 10:08 am
Hey,
Try to remove zxing out of workspace of Eclipse
February 28, 2012 at 12:49 pm
Remove? don’t I need the library..?
February 28, 2012 at 2:06 pm
Did you get this massage when you trie to create New Project?
Or when you want to compile/clean ?
In first option you have to choose the android directory witch include manifest file.
In second option you have to move yours zxing map out of map/directory “workspace” – (map witch include maps/directory)
is it working now ?
February 29, 2012 at 2:56 am
Yes..!
it works..Build successful… and it scans too.
Thanks Rhood!
February 26, 2012 at 11:32 am
I got an exception when i start the intent, it is strange because i step correcly your tutorial, i checked again and again :
02-26 19:29:30.409: E/Surface(8982): Surface (identity=50) requestBuffer(0, 0, 0, 0, 00000033) returned a buffer with a null handle
02-26 19:29:30.409: E/Surface(8982): getBufferLocked(0, 0, 0, 0, 00000033) failed (Out of memory)
02-26 19:29:30.409: E/Surface(8982): dequeueBuffer failed (Out of memory)
02-26 19:29:30.409: E/ViewRoot(8982): OutOfResourcesException locking surface
02-26 19:29:30.409: E/ViewRoot(8982): android.view.Surface$OutOfResourcesException
02-26 19:29:30.409: E/ViewRoot(8982): at android.view.Surface.lockCanvasNative(Native Method)
02-26 19:29:30.409: E/ViewRoot(8982): at android.view.Surface.lockCanvas(Surface.java:314)
02-26 19:29:30.409: E/ViewRoot(8982): at android.view.ViewRoot.draw(ViewRoot.java:1536)
02-26 19:29:30.409: E/ViewRoot(8982): at android.view.ViewRoot.performTraversals(ViewRoot.java:1323)
02-26 19:29:30.409: E/ViewRoot(8982): at android.view.ViewRoot.handleMessage(ViewRoot.java:1961)
02-26 19:29:30.409: E/ViewRoot(8982): at android.os.Handler.dispatchMessage(Handler.java:99)
02-26 19:29:30.409: E/ViewRoot(8982): at android.os.Looper.loop(Looper.java:143)
02-26 19:29:30.409: E/ViewRoot(8982): at android.app.ActivityThread.main(ActivityThread.java:4293)
02-26 19:29:30.409: E/ViewRoot(8982): at java.lang.reflect.Method.invokeNative(Native Method)
02-26 19:29:30.409: E/ViewRoot(8982): at java.lang.reflect.Method.invoke(Method.java:507)
02-26 19:29:30.409: E/ViewRoot(8982): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-26 19:29:30.409: E/ViewRoot(8982): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-26 19:29:30.409: E/ViewRoot(8982): at dalvik.system.NativeStart.main(Native Method)
February 26, 2012 at 11:39 am
I add some details :
If i install zxing app, and if i select it instead of my app when i got the dialog box, , it is working.
And if on eclipse, on the zxing library, i uncheck the checkbox “is librairy” and i run the project, it works too.
The library has been corrected imported to my project, as i got no compile error. Any idea ? strange
thanks
February 26, 2012 at 11:57 am
OK, i tink i got it, it was because on the activity section, i change to put my own activity instead of keep android:name=”com.google.zxing.client.android.CaptureActivity”
But now, i m getting another exception :
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.project/com.google.zxing.client.android.CaptureActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class com.mycompany.project.CustomCameraView
What is very strange is that CustomCameraView is another class (which extends surface view) but which is not called on my activity, it has nothing to do with the acitivity which will start the intent.
Any idea ?
February 26, 2012 at 1:34 pm
OK, i found, the problem was actually really in my CustomSurfaceView class. Why i get this error when i start the intent as this class is not needed ? why i did not get the error before ? mystery
thanks for this tutorial anyway
February 27, 2012 at 9:22 pm
Hello,
I followed this steps, but this doesn’t work.
My error: Under my project in Java Build Path in Libraries is error that testlib.jar – C:\…\android\bin (missing)
Could someone help me?
Thanks a lot.
February 28, 2012 at 9:14 am
Hi,
It really works, but I get the result is always null, please tell me how can I do?
February 29, 2012 at 2:35 am
[...] Sean Owen, one of the developers for ZXing has posted a comment to this blog warning of the pitfalls of integrating ZXing into your own app; doing so just to [...]
February 29, 2012 at 8:09 am
Hi, with some changes all is ok now! Thank you!!
Good tutorial!
March 1, 2012 at 6:28 pm
Hello,
I want to scan QR code with BarcodeScaner if is it install, otherwise, i want to scan code with BarcodeScanner library.
But when i lunch my app, it give me a chiose witch scanner i want to use.
Is it possible to implement this? How?
Thank you in advance.
March 1, 2012 at 7:29 pm
have you read through the post?
March 2, 2012 at 7:59 am
Yes i had.
sorry, that I didn’t write more information what I want to do.
I implemented that my app read qr code. But when I install BarcodeScaner, that app give me a question witch codeScanner i want to use.
Can i implement both this version with Intents, or some other ways?
Maybe is this a stupid question, but I am new in android.
Thank you
March 2, 2012 at 4:36 pm
Thank you very for the very detailed article about nothing.
Every single step of this is wrong, or severely incomplete.
You should remove this from the internet.
March 19, 2012 at 9:21 pm
The zxing project has changed quite a bit since I took the time to write this last June. Still, this post has helped quite a few people and gives you a good head-start if you’re working with the latest zxing release.
March 3, 2012 at 9:53 pm
The resultCode for me is always RESULT_CANCELED. Somebody else mentioned this above but there was no solution posted? Any ideas?
March 5, 2012 at 12:01 pm
Hi, I am following all the steps and I have a problem launching the scanner view.
When it starts, I can’t see the camera view, instead of this I see a grey screen with a white rectangle inside, but I can’t see what I want to scan.
If I launch the scanner in my main activity it works fine, but when I launch it from another activity I have this problem.
Do you know what is happened?
Thanks in advance
PD: I hope I explained well because my English is not very good
March 8, 2012 at 12:26 am
Hello everybody,
I have followed the 4 steps many times very carefully, but in the third step ..
“Create a New Android Project (File –> New –> Android Project).
Set the project name to ZXing (or similar).
Select the “Create project from existing source” radio button
Click “Browse” and navigate to the android project that you downloaded from zxing and click “OK”
Select “Finish” ”
after doing that, there is an “x” on the project’s name (ZXing) on the Package Explorer of Eclipse. If i click on the project, to see it’s contents, i see that there is also an “x” on the src file.
What could be wrong?
Thank you in advance!
March 9, 2012 at 3:47 pm
finally!! it was just the “compiler compliance level” low..
March 8, 2012 at 2:08 pm
Sir.
While Doing Step 3,I got Following Error in Console
“com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Unable to read E:\Android\Android\android-sdk\AndroidManifest.xml: java.io.FileNotFoundException: E:\Android\Android\android-sdk\AndroidManifest.xml (The system cannot find the file specified)”
Can You Help Mee To Remove this Error.. It Really Urgent Sir..
Thankyou
March 9, 2012 at 7:27 am
Hello Sir
i has problem to Download Zxing Src .plz tell me How it is Downloaded.
thanks And Regrads
plz reply
March 19, 2012 at 9:14 pm
You need to use a Subversion client. Google is your friend here
March 9, 2012 at 4:02 pm
Hi, I went through the tutorial and it all went without a hitch but when I try start the activity I get :
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to resume activity {fish.tracer.project/com.google.zxing.client.android.CaptureActivity}: java.lang.NullPointerException
….
Caused by: java.lang.NullPointerException
at com.google.zxing.client.android.CaptureActivity.onResume(CaptureActivity.java:183)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150) etc…
This is the line causing the nullpointerexception :
viewfinderView.setCameraManager(cameraManager);
Why is it calling onResume() for this activity, shouldn’t it be onCreate().
If someone has any idea as to whats causing this error, advice would be greatly appreciated.
Cheers,
Colin.
March 19, 2012 at 9:09 pm
Did you declare the android.permission.CAMERA in your manifest?
April 1, 2012 at 2:23 am
Hi, I had the same problem (same error, same line of code) and was able to fix it. Here’s what happened:
Although this didn’t happen right away, a few compile errors popped up in my library project for the Android source. The errors were related to the fact that the zxing source code was using R.id.somevalue values in switch statements. This isn’t allowed anymore. The fix was to change the switch statements to if/else statements. I did this, and the errors went away.
Once I retested the app, I no longer got the NPE went away. My only guess is the compile errors prevented the R file from being created correctly (or at all), so at runtime when the findViewById method is passed R.id.viewfinder_view, that id doesn’t exist, and thus is null
Hope that helps.
August 23, 2012 at 2:18 pm
wow, i had this error and spent a long time to solved it, thanks Vito for the help, finally i could solve it, fixing many classes in Zxing project, that are using switch statements with R.id.something. I just wanted to know why the Zxing org didnt fix it yet?! anyway, its working to me now!
thanxs again!
March 11, 2012 at 1:03 pm
[...] Hace un tiempo, me planteé como integrar Zxing barcode scanner en un proyecto propio para no tener que llegar a tener instalado ninguna aplicación extra (a pesar de la posibilidad que ofrecen los propios desarrolladores del proyecto para utilizar intents, y de que uno de sus creadores nos advierte de las desventajas de usar esta posibilidad) [...]
March 11, 2012 at 1:10 pm
[...] For some time, I’ve been considering how to integrate Zxing barcode scanner in a project without having installed an extra app to use it (although they give you the chance to use an intent to test if Barcode Scanner is installed and use it). One of ZXing’s creators gave us some reasons of why not to do this, and if you want you can read them here [...]
March 17, 2012 at 2:41 pm
Hi,
I’ve tryed to integrate ZXing into my application, for security reasons, apparently when ZXing is wrapped into my app it takes a lot more time to recognice QR Code. Does it make any sense? Thanks
Eduard
March 19, 2012 at 9:12 pm
Doesn’t make sense to me, maybe you can help zxing by telling it which type of barcode you are trying to scan?
March 21, 2012 at 8:08 am
Hi,
I have recently facing some problems after finishing step4.
public class MobilePOSActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
Intent intent = new Intent(“com.google.zxing.client.android.SCAN”);
intent.putExtra(“SCAN_MODE”,”QR_CODE_MODE”);
}
I tried to add intent.putExtra to the code, but it’s indicating that (“mismatched construct”).And I checked the src file, it seems there are no “/.SCAN” file inside. Would you please help?
Thanks,
Alex
March 21, 2012 at 9:23 am
ZXing has changed since wrote this. It looks like it accepts “SCAN_FORMATS” intent extra with a list of comma separated values.
You should check out http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java
for an example of how to setup the intent to call the scan activity.
March 23, 2012 at 7:55 pm
Hi ,
I am facing this error and have been stuck for days with it. Would be grateful if some one can help me solve this. I have done exactly as mentioned in the blog.
03-23 23:54:09.141: E/AndroidRuntime(1574): FATAL EXCEPTION: main
03-23 23:54:09.141: E/AndroidRuntime(1574): java.lang.ExceptionInInitializerError
03-23 23:54:09.141: E/AndroidRuntime(1574): at java.lang.Class.newInstanceImpl(Native Method)
03-23 23:54:09.141: E/AndroidRuntime(1574): at java.lang.Class.newInstance(Class.java:1409)
03-23 23:54:09.141: E/AndroidRuntime(1574): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-23 23:54:09.141: E/AndroidRuntime(1574): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
03-23 23:54:09.141: E/AndroidRuntime(1574): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
03-23 23:54:09.141: E/AndroidRuntime(1574): at android.app.ActivityThread.access$1500(ActivityThread.java:121)
03-23 23:54:09.141: E/AndroidRuntime(1574): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
03-23 23:54:09.141: E/AndroidRuntime(1574): at android.os.Handler.dispatchMessage(Handler.java:99)
03-23 23:54:09.141: E/AndroidRuntime(1574): at android.os.Looper.loop(Looper.java:130)
03-23 23:54:09.141: E/AndroidRuntime(1574): at android.app.ActivityThread.main(ActivityThread.java:3701)
03-23 23:54:09.141: E/AndroidRuntime(1574): at java.lang.reflect.Method.invokeNative(Native Method)
03-23 23:54:09.141: E/AndroidRuntime(1574): at java.lang.reflect.Method.invoke(Method.java:507)
03-23 23:54:09.141: E/AndroidRuntime(1574): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
03-23 23:54:09.141: E/AndroidRuntime(1574): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
03-23 23:54:09.141: E/AndroidRuntime(1574): at dalvik.system.NativeStart.main(Native Method)
03-23 23:54:09.141: E/AndroidRuntime(1574): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
03-23 23:54:09.141: E/AndroidRuntime(1574): at com.google.zxing.client.android.CaptureActivity.(CaptureActivity.java:107)
03-23 23:54:09.141: E/AndroidRuntime(1574): … 15 more
March 28, 2012 at 4:46 am
After all the comments, i finally see the last comment as the same problem as MINE.
I got the same issue, instead of adding Core.jar, i directly copied the core source code into zxing project.
There could be some issue with the Ant command which we use to make core.jar.
Apart from this , i am also facing another issue.
Now, when CaptureActivity class is called, it calls HelpActivity .
During this , i am getting an “Unable to find an explicit activity class”.
It is trying to look for the activity in the main Project;s AndroidManifest.xml file.
The Help Activity is already in zxing project created as part of the instructions above.
So i am stuck here.
If the author or someone else replies to my problem, it wud be gr8..
Thanks,
Chellappa
March 28, 2012 at 4:50 am
In addition to the above comment, i just added the HelpActivity in the main Project’s AndroidManifest.xml file.
I think this is not the right approach.
But it worked now.
I will wait for someone to comment on this..
Thanks,
Chellappa
April 8, 2012 at 8:57 am
hey how do you add that core source code to zxing project?
April 8, 2012 at 7:11 am
Hi great tutorial…I was trying to integrate it but it app crashes with java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
then i realised will this work on emulator..i dont have a phone to test..How can i fake the camera to take pictures..is this cause of app crash???
April 9, 2012 at 3:15 am
hello,i have integrated zxing library into my application and i have tried executing the above snippet,but iam getting “the application has stopped unexpectedly” on emulator.Please help me to fix this.
April 9, 2012 at 9:27 am
hello,i have integrated zxing library into my application and i have tried executing the above snippet,but iam getting “the application has stopped unexpectedly” on emulator.Please help me to fix this.
April 11, 2012 at 4:42 am
Hello,I have integrated zxing library in to my application,i have tried executing the above QR code,iam getting-”the application has stopped unexpectedly” on emulator.Please help me to fix this and iam awaiting for your reply…………………………
April 13, 2012 at 6:57 am
Hello
when i use
Intent intent = new Intent(“com.google.zxing.client.android.SCAN”);
intent.putExtra(“SCAN_MODE”, “PRODUCT_MODE”);
startActivityForResult(intent, 0);
the scan view is opened which covered whole screen. instead of that is it possible to open that event inside any layout which wont cover full screen . so that i can add header and footer at top and bottom
any help appreciated
Thank a lot
April 13, 2012 at 5:45 pm
The link you provided actually points to ivy not to ant (download from here http://ant.apache.org/ivy/download.cgi).
I found ant here:
http://ant.apache.org/bindownload.cgi
and an excellent installation guide here:
http://madhukaudantha.blogspot.com/2010/06/installing-ant-for-windows-7.html
thanks for the post btw
April 17, 2012 at 11:38 am
Please can any one gave an example an applied work of this example? please please please
April 24, 2012 at 10:53 am
i’m using Zxing 2.0. I created the jar file with ant, added to project, modified the manifest file , added the code above, but it gives an error : java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mypackage.barcode/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassNotFoundException: com.google.zxing.client.android.CaptureActivity in loader dalvik.system.PathClassLoader@44c07928
Can anyone please upload a working example?
Thanks advanced.
August 2, 2012 at 10:49 am
Hi Molnar,
Have you got the solution to your problem.
I am also facing the same problem.
Any help would be much appreciated.
April 25, 2012 at 5:05 am
I used to have this problem(100 errors) where by R.java is not created, until I removed android:xlargeScreens=”true” from android manifest file
April 25, 2012 at 9:30 pm
Thanks for this. I’ve got everything working except for one thing. Why is the Android robot logo covering the entire view during the qr code scanner?
April 25, 2012 at 9:42 pm
Thanks for this. Everything is working for me with one caveat: the scanner’s viewport is covered with a gigantic Android robot logo. Any ideas what I’ll have to do to eliminate it?
April 27, 2012 at 4:27 pm
[...] fosse claro, inclusive no site oficial do ZXing do projeto. Após algumas buscas encontrei esse tutorial do ZXing que explica de forma simples e clara como fazer esta integração. Fiz tudo conforme está [...]
April 30, 2012 at 5:59 pm
Hello,
unfortunately, it is not working for me. In step 4 I insert the code into my trigger function, but nothing happens and I have no error in Eclipse. I would also be very happy if anyone could post a link to a working sample here, please!
By the way: Do I have to build the core.jar by myself or will the downloaded core.jar from the zxing-2.0.zip from the ZXing-download section do?
Thanks,
Florian
May 3, 2012 at 10:23 am
Hello,
is it also possible to use the core.jar from the zxing-2.0.zip which is available from the zxing downlaod section instead of building my own core.jar with ant?
Being a newbie, it would also be very helpful to have a link to a full working sourcecode in this forum, please!
Thanks,
Florian
May 4, 2012 at 8:45 am
[...] WiFi Unlocker App for Android ReviewEasy Downloader App for Android ReviewPdt6100Pdt6100Integrate zxing barcode scanner into your Android app natively using Eclipse .wslHeader{ display:inline!important; font-weight: normal!important; text-shadow: none; [...]
May 21, 2012 at 12:37 pm
can u tell me how to checkout the zxing src files? I don’t know how to download & integrate in my project
May 22, 2012 at 8:38 am
[...] Sounds really cool but as a developer it is as complicated as qrcode itself . [...]
May 22, 2012 at 12:25 pm
Is it require that barcode scanner apk ainstalled before proceeding?
Because my app stops when I click button with VFY error
May 23, 2012 at 11:05 pm
[...] http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app… [...]
May 31, 2012 at 9:09 pm
Hi everyone,
I’ve got a problem and would like to know if others also have the same.
I joined the zxing2.0 to my project. Everything worked well except when I try to scan for PRODUCT_MODE. If I use the application recognizes QR_CODE_MODE if PRODUCT_MODE use the application does not recognize the code.
Anyone had this problem? If yes, what is the solution.
Thank you,
Luiz
June 2, 2012 at 3:32 pm
Hi;
my problem is that my layout does not appear in “graphiqual layaut”. What is the problem help me please
June 12, 2012 at 8:55 pm
Thanks. Works fine.
June 18, 2012 at 7:57 am
its working fine for product bar code. i need it for vin bar code. what are changes need it ?
June 18, 2012 at 3:07 pm
I had an Android Runtime Exception too because a class wasn’t found, and I solved the problem. To add an external Jar with a recent Eclipse version, you need to create a folder libs in your root project, copy/paste the core.jar in this folder and add the core.jar from this folder.
src : http://stackoverflow.com/a/6859020
Hope this helps
July 4, 2012 at 5:14 am
What did it for me was to tick the box for core.jar in zxing android project Properties -> Java Build Path -> “Order and Export” (it was listed before, but not selected)
http://stackoverflow.com/questions/9889737/updating-sdk-got-noclassdeffounderror-for-zxing
July 11, 2012 at 5:03 pm
Hi, i’m getting error in the codes after importing those files in the project. What is the solution for this ?
July 12, 2012 at 1:47 pm
Thanks – fantastic tutorial. In addition to the above comment I also found that with the latest ADT tools, I didn’t need to add core.jar to the main project
July 16, 2012 at 11:20 pm
So, I am having trouble with Step 3, no matter what I select it wont let me create from existing source. I tried just doing the core and android folder no luck, so got the whole trunk nothing. Do I need to create a project in Step 2 and then do this?
July 17, 2012 at 4:28 pm
Nevermind I’m a dope, I guess I shouldn’t have been trying to configure this at work. I got things configured pretty quickly last night on the computer I will need this for anyway.
July 17, 2012 at 11:45 am
Hi I have followed all the steps, still some issue is coming and my application is not working. also the apk size is 55mb which is huge. Can we do something to reduce the apk size?
July 18, 2012 at 11:21 pm
Cool after some muddling I finally got this to work, sean isn’t going to be happy as I had to switch his switch statements with ifs and had to check the box for including the core.jar, but at least my reasoning for this project was to save me some time and focus on an app for a good cause. Now I just will have to modify the search from google to my own database as I am checking against specific datasets. Too bad I have to configure this at home now, SHHH!!! It’s kind of work related
, I blame my director
July 19, 2012 at 3:06 am
You don’t have to change any code, unless you use an outdated Android SDK. You are supposed to include core.jar; how would it work otherwise? I can’t see how this ‘saved you some time” compared to integrating by Intent, which is like 10 lines of code instead of this hassle. You won’t be the first or last to copy and paste everything. Can you at least change the UI and Intents so you’re not pretend you are Barcode Scanner to our users?
July 19, 2012 at 4:52 pm
Yea, I am not using this for the main app, just a prototype. I will probably contact you later if I need any assistance doing it the “right” way for the final app. I just don’t have a lot of time this was just told to me the other day and I want to focus on my app not the barcode portion which as you have stated has been don’t so why reinvent the wheel.
And seeing how I just installed the SDK not sure why you would think I am outdate, it says your code cant be used since ADT 14 I think as I just recalling, but I don’t want to argue. Anyway it works for what I am doing and if this is going to be released beyond my inital use(which I am hoping because it is a very beneficial app for a widely used government program), I will be sure everything is done correctly. I will want to give credit appropriately as I think this will only be at most asking for a optional donation to go to the program if allowed or to who they would like it to go to.
I am using the core.jar, but the switch case in the android project was what gave the errors, you have seen this in several of these postings, either its the code or the implementation isnt clear. After getting everything setup correctly the actual instructions above only take like 10 minutes to implement, so that’s pretty quick in my book.
Thanks to you both either way, I will keep you posted.
July 19, 2012 at 5:37 pm
(Regarding if-else — actually your SDK version is not the issue indeed. It’s that you’re targeting a higher level of Android than the project does. You would have to change this code then, yes.)
July 19, 2012 at 5:40 pm
Nope, I’m wrong there again. Now I remember, having read up on the internet again. It’s because the app is not a library project, but if you use it as such, you would have to make this code change as of SDK14. Obviously, it’s not intended to be used that way, so it’s not written to work with this use case.
July 20, 2012 at 1:50 am
Cool thanks for explaining.
August 1, 2012 at 12:57 pm
any body help me how to use zxing in my new android application….
please reply…
August 1, 2012 at 12:58 pm
I Need Full Support for develop barcode scanner in android..
August 20, 2012 at 12:14 pm
onActivityResult not calling……pls tell the solution..
August 30, 2012 at 1:48 pm
Hey thanx for this good guide. I followed all the steps, but a got an error message after starting the intent. My Logcat told me, that it is unable to find the classes. I received the messages:
trying to launch com.febros.barcodetest/com.google.zxing.client.android.CaputreActivity
after that i receive the message:
unable to resolve static field 1007 (ISSUE_Number) in /com/google/zxing/ResultMetadataType;
….
I created a new project from existing code. Defined this project as a lib and add the extern core.jar, I created before with ant. My own project imported the lib fom zxing.
By the way I was thinking, that the IDE (Eclipse) is not working well and I decompilded the classes.dex from the apk file. But the classes CameraActivity is in the bundle. The Activity is also in the Mainfest implemented.
Please help me out I trying to find a solution since 2 days.
October 10, 2012 at 10:40 am
I have the same problem…I will be really happy to get a solution …
Thanks
September 19, 2012 at 2:51 pm
To be more robust use this when defining your intent:
Intent intent = new Intent(com.google.zxing.client.android.Intents.Scan.ACTION);
intent.putExtra(com.google.zxing.client.android.Intents.Scan.MODE,
com.google.zxing.client.android.Intents.Scan.QR_CODE_MODE);
This way you don’t have to react on changes in arbitrary strings.
September 25, 2012 at 8:35 am
October 8, 2012 at 9:11 am
I want to integrate zxing library in my android app but I don’t want to use intent based approach. Please help me solve this problem. Maybe you know some useful link how for tutorial
October 8, 2012 at 2:49 pm
Hello, I want to know if i execute success, the barcode scanner will be build up in my application? (which mean when I use the barcode scanner function in my application, we don’t need to download the barcode scanner separately and the application can also run normally?)
October 11, 2012 at 9:33 pm
This has helped me a lot, but I am still stuck.
After I get the barcode scanner up, it scans, but then just says “found url” and then returns to the index of my webview app template.
I am not sure how to get the scanner to open the results in my the apps webview, I can post a link to the source files if someone can help me in anyway
Thanks!
October 15, 2012 at 10:29 am
[...] work as a solo application so it crush evrytime i start it. I do evry thing as in followed tutorial http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app… however, it somehow doesn’t work. So i tryied to start the captureActivity as application [...]
October 18, 2012 at 11:21 am
Sorry, how can i download the source code?? I don’t know how to download using svn.
October 18, 2012 at 2:54 pm
I followed these steps but in my project, under Java Build Path come out an error on android Dependencies saying that com.google.zxing.client.android.captureactivity.jar is missing.
What am I doing wrong?
October 23, 2012 at 2:22 am
works nicely..thanks for the guide
December 12, 2012 at 10:54 pm
hey, I followed the guide and it didn’t work. I rechecked everything and all seems fine until I press the scan button.
Once I scan, it all just stops and device says App stopped. Logcat reports errors which I’m unable to follow.
I’m a newbie to android development. Is there anything you did other than the steps mentioned above ?
October 23, 2012 at 9:39 am
Well i’m having a problem i download and build app, import core.jar and try to run is as stand alone application but it crashes when loading metadata. Any idea why?
November 7, 2012 at 10:51 am
very informative guidance. It worked perfectly without single error. Thanks a lot.
One question do we want to have third party QR scanner installed to make this work.
November 14, 2012 at 7:21 pm
Hi am testing the app after following the steps above. Unluckily it is not working, the app launches, but as soon as i click on the Scan button, the app suddenly stops. I’ve followed all steps mentioned. Please help me
November 22, 2012 at 7:11 am
I Keep getting resource errors.
ZXing/src/com/google/zxing/client/android/CaptureActivity.java:326: constant expression required
case R.id.menu_share:
any help on this?
November 22, 2012 at 4:25 pm
Hi everyone,
I setup successfully. But when I run app and hover the qr code or barcode, i can’t get any information about the qr code or barcode. It’s just show the image of the qr code (barcode) that it’s recognize and the text “found plain text” or “found product” then close my app immediately.
All the things I need is the information of the product.
Any idea for this problem would be appreciate.
Thanks a lot.
November 26, 2012 at 12:16 pm
[...] bien, par contre il va falloir se remettre à Java et ça pas être de la tarte je pense. Un petit tuto sympa. Tout ça pour essayer de reprendre mon [...]
December 4, 2012 at 8:32 pm
I follow same step but i got an error while i run in eclipse emulator like PACKAGE NAME stopped unexpectedly..so how can i solve this error.
December 7, 2012 at 10:26 am
[...] http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app… [...]
December 11, 2012 at 8:38 am
Thanks so much !
Works so good !
Congratulations
December 13, 2012 at 2:00 am
[...] http://stackoverflow.com/a/4854637/1273954 http://stackoverflow.com/a/4825803/1273954 & also http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app… [...]
December 13, 2012 at 6:52 pm
Hi I followed the guide line by line but when I execute the application I get fatal exception upon clicking the scan button. The Logcat record is as followed :
12-13 12:36:06.781: E/AndroidRuntime(2493): FATAL EXCEPTION: main
12-13 12:36:06.781: E/AndroidRuntime(2493): java.lang.RuntimeException: Unable to resume activity {com.site.myscanner/com.google.zxing.client.android.CaptureActivity}: java.lang.NullPointerException
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2564)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2607)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2088)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.app.ActivityThread.access$600(ActivityThread.java:134)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.os.Looper.loop(Looper.java:137)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.app.ActivityThread.main(ActivityThread.java:4697)
12-13 12:36:06.781: E/AndroidRuntime(2493): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 12:36:06.781: E/AndroidRuntime(2493): at java.lang.reflect.Method.invoke(Method.java:511)
12-13 12:36:06.781: E/AndroidRuntime(2493): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
12-13 12:36:06.781: E/AndroidRuntime(2493): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
12-13 12:36:06.781: E/AndroidRuntime(2493): at dalvik.system.NativeStart.main(Native Method)
12-13 12:36:06.781: E/AndroidRuntime(2493): Caused by: java.lang.NullPointerException
12-13 12:36:06.781: E/AndroidRuntime(2493): at com.google.zxing.client.android.CaptureActivity.onResume(CaptureActivity.java:163)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1154)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.app.Activity.performResume(Activity.java:4607)
12-13 12:36:06.781: E/AndroidRuntime(2493): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2546)
12-13 12:36:06.781: E/AndroidRuntime(2493): … 12 more
December 13, 2012 at 11:29 pm
fixed …
March 1, 2013 at 11:17 am
Hi! I’ve got the same error as you, could you please explain how you fixed it.
Thx you!
December 15, 2012 at 9:47 am
Hello, i downloaded the android\ dir, and i imported it in eclipse. But is showing a lot of errors in that project. Help me out.
December 21, 2012 at 11:30 am
Hi,
This piece of code for QR Scanner not for Bar Code scanner,
Because this code can read QR code, not bar code.
Can any let me know, how to scan Bar code. please share me details
r
Thanks in adv.
rkjhaw@hotmail.com
February 18, 2013 at 7:36 pm
change scan mode form QR_CODE_MODE to ONE_D_MODE (for Code128A,B, UPC-A) or try PRODUCT_MODE for UPC-A etc.
December 28, 2012 at 10:18 am
this post inspired me a lot….thanks to the author.
how can i use a scan type(red line moving across the screen) process in my application to create a scanning of things perception.
January 3, 2013 at 10:34 am
01-03 10:28:15.445: E/AndroidRuntime(3405): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN pkg=com.google.zxing.client.android (has extras) }
==================================================== I am getting this exception. What is going on with my code. I can’t use :- IntentIntegrator integrator = new IntentIntegrator(shopping.this);
integrator.initiateScan();
In my project
January 3, 2013 at 10:35 am
Please take me out of this issue..
January 17, 2013 at 12:32 am
Has anyone tried this tutorial successfully with version 2.1 of ZXing?
January 30, 2013 at 3:45 pm
I recently integrated zxing 2.1 natively, much like the process I described in an earlier comment.
January 21, 2013 at 7:19 am
“Integrate zxing barcode scanner into your Android app natively
using Eclipse | Damian Flannery’s Blog” was a extremely pleasant post, . Keep authoring and I will continue reading through! I appreciate it -Charline
January 22, 2013 at 3:13 pm
[...] create an app that integrating zxing. I followed as per this site http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app…. Now i have error in drawable folder. Please guide [...]
January 24, 2013 at 3:58 pm
I would first like to thank you so much for a wonderful job you did. Well, I have no problem with the code, but I tried installing it on Nexus 7. The installation was successful but I didn’t get any OPEN option after installing which we generally should get. I also couldn’t find the application in my application list on my Tablet. Is there anything I have to do to make it work on Nexus 7?
February 5, 2013 at 5:56 am
[...] http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app… [...]
February 7, 2013 at 1:00 pm
[...] Basically, I followed this: http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app… [...]
February 12, 2013 at 9:20 pm
The provided information was very useful to me, but I had to solve two problems. The first war related to the fact that the switch-case statement cannot be more used with resources (it is necessary to replace it with “if-else” statement). The way to fix the problem in the ZXing 2.1 files is described following this link:
http://tools.android.com/tips/non-constant-fields
The other problem was that the app crashed the first time after installing it. This was because the function “showHelpOnFirstLaunch” was called, generating the crash of the app. I have commented this call in onCreate in CaptureActivity.java.
After these two changes everything worked for me.
February 18, 2013 at 7:32 pm
Great article, just (Feb 2013) built an app with it, couple of updates to share. 1 – The new SDK requires certain switch statements in CaptureActivity source be converted to if-else. Just look at the redX’s, click cursor on switch and do Ctrl-1 (number one) and SDK does it for you. Otherwise the app won’t launch from my app. 2 – The changes in the manifest as shown above, if you already have a MAIN LAUNCHER in your app, you may want to make zxing app without the MAIN intent-filter or you get two icons in your device. In that case, delete the MAIN intent-filter in zxing activity and add android:exported=”false” in the activity tag. 3-Just fyi, other scan modes besides QR_CODE_MODE are ONE_D_MODE (for code128, UPC etc), PRODUCT_MODE (for UPC) and DATA_MATRIX_MODE.
February 25, 2013 at 1:09 am
Awesome tutorial, i just make barcode scanner !
but i think you must add core.jar in the lib folder on your project directory. because when i only add in the build path, my apps going force close, and i try to add core.jar in the lib folder directory.
thank you damian !
February 25, 2013 at 10:47 pm
Thanks for the wonderful article.
However, I am getting a pop of complete action by in my mobile after clicking the button. Any help ?
March 6, 2013 at 4:00 pm
[...] http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app… [...]
March 17, 2013 at 6:23 am
Can someone help me i m getting the following errors in logcat during executing…
03-17 11:50:14.785: W/dalvikvm(27807): VFY: unable to resolve static field 1460 (ISSUE_NUMBER) in Lcom/google/zxing/ResultMetadataType;
03-17 11:50:14.785: D/dalvikvm(27807): VFY: replacing opcode 0×62 at 0×0017
03-17 11:50:14.785: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.785: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/ResultPoint;)
03-17 11:50:14.785: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/ResultPoint;)
03-17 11:50:14.785: I/dalvikvm(27807): Could not find method com.google.zxing.ResultPoint.getX, referenced from method com.google.zxing.client.android.CaptureActivity.drawLine
03-17 11:50:14.785: W/dalvikvm(27807): VFY: unable to resolve virtual method 3987: Lcom/google/zxing/ResultPoint;.getX ()F
03-17 11:50:14.785: D/dalvikvm(27807): VFY: replacing opcode 0x6e at 0×0000
03-17 11:50:14.785: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.785: I/dalvikvm(27807): Could not find method com.google.zxing.Result.getResultPoints, referenced from method com.google.zxing.client.android.CaptureActivity.drawResultPoints
03-17 11:50:14.785: W/dalvikvm(27807): VFY: unable to resolve virtual method 3983: Lcom/google/zxing/Result;.getResultPoints ()[Lcom/google/zxing/ResultPoint;
03-17 11:50:14.785: D/dalvikvm(27807): VFY: replacing opcode 0x6e at 0×0003
03-17 11:50:14.785: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.785: I/dalvikvm(27807): Could not find method com.google.zxing.Result.toString, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeExternally
03-17 11:50:14.785: W/dalvikvm(27807): VFY: unable to resolve virtual method 3986: Lcom/google/zxing/Result;.toString ()Ljava/lang/String;
03-17 11:50:14.785: D/dalvikvm(27807): VFY: replacing opcode 0×74 at 0x007d
03-17 11:50:14.790: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.790: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.790: I/dalvikvm(27807): Could not find method com.google.zxing.Result.getBarcodeFormat, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeInternally
03-17 11:50:14.790: W/dalvikvm(27807): VFY: unable to resolve virtual method 3980: Lcom/google/zxing/Result;.getBarcodeFormat ()Lcom/google/zxing/BarcodeFormat;
03-17 11:50:14.790: D/dalvikvm(27807): VFY: replacing opcode 0×74 at 0x004c
03-17 11:50:14.790: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.790: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.790: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.790: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.790: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.795: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.795: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.795: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.795: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.795: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.795: I/dalvikvm(27807): Could not find method com.google.zxing.Result.getText, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecode
03-17 11:50:14.795: W/dalvikvm(27807): VFY: unable to resolve virtual method 3984: Lcom/google/zxing/Result;.getText ()Ljava/lang/String;
03-17 11:50:14.795: D/dalvikvm(27807): VFY: replacing opcode 0x6e at 0×0070
03-17 11:50:14.795: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.795: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.795: W/dalvikvm(27807): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05b7 at 0×19 in Lcom/google/zxing/client/android/CaptureActivity;.
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05b3 at 0x1b in Lcom/google/zxing/client/android/CaptureActivity;.
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05b6 at 0x1d in Lcom/google/zxing/client/android/CaptureActivity;.
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05ac at 0x3c in Lcom/google/zxing/client/android/CaptureActivity;.drawResultPoints
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05a6 at 0×44 in Lcom/google/zxing/client/android/CaptureActivity;.drawResultPoints
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05b8 at 0xb1 in Lcom/google/zxing/client/android/CaptureActivity;.handleDecodeExternally
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05b8 at 0xbd in Lcom/google/zxing/client/android/CaptureActivity;.handleDecodeExternally
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05b5 at 0xd0 in Lcom/google/zxing/client/android/CaptureActivity;.handleDecodeExternally
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05b3 at 0xe9 in Lcom/google/zxing/client/android/CaptureActivity;.handleDecodeExternally
03-17 11:50:14.800: I/dalvikvm(27807): DexOpt: unable to optimize static field ref 0x05b2 at 0xfc in Lcom/google/zxing/client/android/CaptureActivity;.handleDecodeExternally
03-17 11:50:14.805: W/dalvikvm(27807): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/zxing/client/android/CaptureActivity;
03-17 11:50:14.805: W/dalvikvm(27807): Class init failed in newInstance call (Lcom/google/zxing/client/android/CaptureActivity;)
03-17 11:50:14.805: D/AndroidRuntime(27807): Shutting down VM
03-17 11:50:14.805: W/dalvikvm(27807): threadid=1: thread exiting with uncaught exception (group=0x40c321f8)
03-17 11:50:14.805: E/AndroidRuntime(27807): FATAL EXCEPTION: main
03-17 11:50:14.805: E/AndroidRuntime(27807): java.lang.ExceptionInInitializerError
03-17 11:50:14.805: E/AndroidRuntime(27807): at java.lang.Class.newInstanceImpl(Native Method)
03-17 11:50:14.805: E/AndroidRuntime(27807): at java.lang.Class.newInstance(Class.java:1319)
03-17 11:50:14.805: E/AndroidRuntime(27807): at android.app.Instrumentation.newActivity(Instrumentation.java:1026)
03-17 11:50:14.805: E/AndroidRuntime(27807): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1883)
03-17 11:50:14.805: E/AndroidRuntime(27807): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
03-17 11:50:14.805: E/AndroidRuntime(27807): at android.app.ActivityThread.access$600(ActivityThread.java:127)
03-17 11:50:14.805: E/AndroidRuntime(27807): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
03-17 11:50:14.805: E/AndroidRuntime(27807): at android.os.Handler.dispatchMessage(Handler.java:99)
03-17 11:50:14.805: E/AndroidRuntime(27807): at android.os.Looper.loop(Looper.java:137)
03-17 11:50:14.805: E/AndroidRuntime(27807): at android.app.ActivityThread.main(ActivityThread.java:4507)
03-17 11:50:14.805: E/AndroidRuntime(27807): at java.lang.reflect.Method.invokeNative(Native Method)
03-17 11:50:14.805: E/AndroidRuntime(27807): at java.lang.reflect.Method.invoke(Method.java:511)
03-17 11:50:14.805: E/AndroidRuntime(27807): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
03-17 11:50:14.805: E/AndroidRuntime(27807): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
03-17 11:50:14.805: E/AndroidRuntime(27807): at dalvik.system.NativeStart.main(Native Method)
03-17 11:50:14.805: E/AndroidRuntime(27807): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
03-17 11:50:14.805: E/AndroidRuntime(27807): at com.google.zxing.client.android.CaptureActivity.(CaptureActivity.java:96)
03-17 11:50:14.805: E/AndroidRuntime(27807): … 15 more
April 12, 2013 at 12:45 am
Forget about zxing! After spending all day trying to make it work, I finally found Zbar. Excellent! No muss, No fuss! And very lean and mean, as opposed to the rather hefty zxing! All I needed was a way to read QR codes in my app and Zbar was perfect!!
April 16, 2013 at 2:00 pm
[...] reading capabilities of Zxing into a stand-alone app, and have been using this very helpful guide http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app… along with these pointers Integration ZXing library directly into my Android application but after [...]
April 22, 2013 at 2:18 pm
I’ve got it working but any changes I make to the new ZXing project don’t get applied to my project that uses ZXing… I’ve tried recompiling, deleting the bin folder completely, re-adding the library to new project, etc. Any ideas?
April 24, 2013 at 5:22 am
Thanks for sharing this article.. I implement this scanner in my application. Intially it work file while i m trying it in my android mobile phone.. but after some time it showing “unfortunately has stopped” while pressing scan qrcode button.. Plz any body help to fix this issue
April 26, 2013 at 11:32 am
Try to comment the line
beepManager.playBeepSoundAndVibrate();
in captureactivity in the zxing library.
April 24, 2013 at 8:28 pm
Great tutorial, can I ask you about how to retrieve the the data from a barcode