将ZXing库直接集成到我的Android应用程序中 [英] Integrating the ZXing library directly into my Android application
问题描述
我只是在无奈之下写这篇文章:)我被分配去为Android 1.6手机制作一个独立的条形码扫描仪(作为概念证明).
为此,我发现了ZXing库.
我已经在Google上进行了搜索,请在此处阅读有关使用常识的StackOverflow相关主题.似乎没有任何帮助,而我只是无法在这种心理封锁上打个洞:/
我知道可以使用lib并创建自己的独立条形码扫描仪.我读过,到目前为止,使用Zxing员工提供的条形码扫描仪"是最简单的解决方案(通过Intent).不幸的是,这不是一个选择,并且需要一个独立的应用程序.
所以总结一下我的问题:
- 如何通过Eclipse将ZXing源库集成到我的Android Code项目中?
- 集成后...如何利用lib来加载"扫描功能?
- 几乎首选使用分步指南,因为我刚开始在Eclipse中工作.
我试图使我的代码项目依赖于ZXing源文件夹中的Android文件夹.当我这样做时,会出现一些小错误,主要是关于"org.apache"(??)
我只是想不通...所以一些提示将是最有帮助的.
预先,谢谢你:)
更新! -已解决+指南
我设法弄清楚了:)在下面,您可以阅读分步指南,以便它可以帮助遇到与我同样的问题的其他人;)
- 安装Apache Ant-(参见此YouTube视频以获取配置帮助)
- 从ZXing主页下载ZXing源并解压缩
- 使用Windows命令行(运行-> CMD)导航到下载的
zxing src
的根目录. - 在命令行窗口中-键入
ant -f core/build.xml
并按Enter键,让Apache正常运行[So to sum up my problem :
- How to integrate ZXing source lib into my Android Code project through Eclipse?
- When integrated ... how to make use of the lib, to "load" the scanning function?
- 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 :)
解决方案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 ;)
- Install Apache Ant - (See this YouTube video for config help)
- Download the ZXing source from ZXing homepage and extract it
- With the use of Windows Commandline (Run->CMD) navigate to the root directory of the downloaded
zxing src
. - In the commandline window - Type
ant -f core/build.xml
press enter and let Apache work it's magic [having issues?] - Enter Eclipse -> new Android Project, based on the android folder in the directory you just extracted
- Right-click project folder -> Properties -> Java Build Path -> Library -> Add External JARs...
- 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 :)
这篇关于将ZXing库直接集成到我的Android应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!