1. JustAnotherDev

    Thank you for taking the time to post your experience in getting ZXing to work with eclipse/android. I am sure it has saved me a little time in figuring this out on my own.


    P.S. Perhaps you should post these instructions on the ZXing wiki…


  2. Hi,

    This is very good article.I strugled alot to use the api.Now it is working fine.Thanks alot.

    Hari Vemula

  3. worked

    Following your directions exactly, the project doesn’t see to generate the R.java file. so I receive errors everywhere. I’ve tried literally everything except posting a comment. Can you lend a few suggestions?


    1. I am sorry to hear that. This project may have changed a lot from when I was experimenting with it and I’ve moved on from it since then (building from Windows was something of a fluke anyway, since Linux is the generally preferred platform for Android develoment).

  4. GB

    The build fails becouse AndroidManifest.xml includes android:installLocation=”auto” and it requires sdk >= 8.
    If you remove the line then the project builds fine.


  5. It took me a while but I found a few additional requirements that might help (as of at least May 2011)

    In the “res/values” folders (looks like one per language), the “strings.xml” files contain a line with %s and %f. You must remove the percentage sign or Eclipse will have a fit.

    You can also change the “app_name” (how it appears below the icon on the device) by editing the res/values/strings.xml (Where it says “Barcode Scanner”)

    Finally if you want to change the icon, make sure to change it in res/drawable AND res/drawable-hdpi (and possibly the other drawable folders)

    I see that 72px x 72px in the high dots per inch, and 48px by 48px in the regular folder seem to look good.


  6. Great tutorial Martin! too bad I have “Worked” same problem.. it doesn’t generate the R.java file :( if I’ll find a solution I’ll be happy to share it posting again.

    PS: I tried under Linux (Ubuntu) and Windows XP and I have the same identical problem.


  7. I’m sorry I missed “Frank Forte” answer and… he is absolutely right!
    I edited all the mistakes in res/values folder, once I corrected all the errors Eclipse kindly generated the R.java file :)

  8. errooorr

    AndroidManifest.xml file missing! HELP

  9. a

    I ma trying to put the barcodereader example into a subfolder of my workspace. To be clear:
    my workspace is in folder .\workspace
    inside this I would like to have a subfolder .\workspace\zxing
    and inside this .\workspace\zxing\android with the barcode reader project.

    I have tried all possible ways I could think of, and it seems it is impossible to put a project into subfolder.
    Is there a way to accomplish these or eclipse just forces you to be disorganized?


    1. I haven’t done development on this particular project in a while. It may be that it’s even more problematic to build on Windows than it used to be.

  10. Madhulika

    I have done everything according to your instructions.
    However, i cant run the project because –
    “BarExample] AndroidManifest.xml file missing!”
    Thats the error i get.
    Im using the 2.0 version of zxing.
    Please please help! :'(


    1. Unfortunately I haven’t worked on this in some time, so I cannot tell you what’s specifically wrong. It could be a problem with the way you are working with the project itself. Don’t just copy the project into your workspace and then try to run it… put it elsewhere and them import the project into your workspace via Eclipse! A similar question was asked here which covers this general sort of issue (this isn’t uncommon, especially if you’re new to Android).

  11. Madhulika

    I guess i will just download the older version of Zxing (1.4, like you suggested) and try to see if i can get rid of the error.
    Thank you. :)


    1. Like I said, this sounds like a setup problem rather than a Zxing-specific problem. If you don’t import the project correctly into Eclipse you won’t have the right manifests.

  12. Madhulika

    But i imported correctly, i think.
    Project -> new android project … etc
    just like you’d said

  13. Madhulika

    I figured out how to do it! 😀
    Problem now is,
    i bring the scanner in front of a QR code and still it doesnt play the ‘beep’ sound.
    it doesnt detect it.
    why? :(


    1. For the benefit of any other readers, how’d you get it working? As for the problem, I have no idea. Again, I’m not a maintainer of this package.

  14. MSteve

    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.


Leave a Reply

Your email address will not be published. Required fields are marked *