Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
900 views
in Technique[技术] by (71.8m points)

barcode - Integrating the ZXing library directly into my Android application

I'm writing this in mere desperation :) I've been assigned to make a standalone barcode scanner (as a proof of concept) to an Android 1.6 phone.

For this i've discovered the ZXing library.

I've googled, read related topics here on StackOverflow used common sence and so forth. Nothing seemed to have helped, and i just can't punch a hole on this mentale blockade :/

I know it to be possible, to use the lib, and create your own standalone barcode scanner. I've read that using the "Barcode Scanner" provided by the Zxing folks, is by far the easiest solution (via Intent). Unfortunately this is not an option, and a standalone app is desired.

So to sum up my problem :

  1. How to integrate ZXing source lib into my Android Code project through Eclipse?
  2. When integrated ... how to make use of the lib, to "load" the scanning function?
  3. A step to step guide is almost prefered because i just started working in Eclipse.

I've tried to make my code project dependant of the Android folder from the ZXing source folder. When i do so, a handfull errors emerge, mostly concerning 'org.apache' (??)

I just can't figure it out ... so a few hints would be most helpfull.

In advance, thank you :)

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

UPDATE! - SOLVED + GUIDE

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

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

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...