将 ZXing 库直接集成到我的 Android 应用程序中 [英] Integrating the ZXing library directly into my Android application

查看:36
本文介绍了将 ZXing 库直接集成到我的 Android 应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写这篇文章只是出于绝望:) 我被指派为 Android 1.6 手机制作一个独立的条码扫描仪(作为概念证明).

为此,我发现了 ZXing 库.

我在谷歌上搜索过,在 StackOverflow 上阅读过相关主题,使用过的常识等等.似乎没有任何帮助,我就是无法在这种心理封锁上打一个洞:/

我知道使用该库并创建您自己的独立条码扫描仪是可能的.我读过使用 Zxing 人员提供的条形码扫描仪"是迄今为止最简单的解决方案(通过 Intent).不幸的是,这不是一个选项,需要一个独立的应用程序.

总结一下我的问题:

  1. 如何通过 Eclipse 将 ZXing 源代码库集成到我的 Android Code 项目中?
  2. 集成后...如何利用库来加载"扫描功能?
  3. 逐步指南几乎是首选,因为我刚开始在 Eclipse 中工作.

我尝试使我的代码项目依赖于 ZXing 源文件夹中的 Android 文件夹.当我这样做时,会出现一些错误,主要是关于org.apache"(??)

我就是想不通……所以一些提示会很有帮助.

提前谢谢你:)

解决方案

更新!- 已解决 + 指南

我已经设法弄明白了 :) 在下面,您可以阅读分步指南,希望它可以帮助与我遇到相同问题的其他人;)

  1. 安装 Apache Ant -(观看此 YouTube 视频以获得配置帮助)
  2. 从ZXing主页下载ZXing源码并解压
  3. 使用Windows命令行(运行->CMD)导航到下载的zxing src的根目录.
  4. 在命令行窗口中 - 输入 ant -f core/build.xml 按回车键让 Apache 工作,这很神奇 [有问题吗?]
  5. 进入Eclipse -> new Android Project,基于你刚刚解压的目录下的android文件夹
  6. 右键单击项目文件夹 -> 属性 -> Java 构建路径 -> 库 -> 添加外部 JAR...
  7. 导航到新解压的文件夹并打开核心目录并选择core.jar ...回车!

现在您只需要更正翻译和 AndroidManifest.xml 文件中的一些错误:) 现在您可以愉快地编译了,您现在将拥有一个基于 ZXing 源代码的独立条码扫描仪应用程序;)

快乐的编码人员 - 我希望它可以帮助其他人:)

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 :)

解决方案

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 :)

这篇关于将 ZXing 库直接集成到我的 Android 应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆