让 ZXing 开始工作
我遵循了所有说明、维基、入门、指南、帮助, 等等我可以找到有关ZXing项目的信息。 经过多次调试,终于成功使用ant编译了 core.jar、javame.jar 和 javese.jar。 我想将 ZXing 集成到我的代码中,即我希望扫描 \读取条形码并处理其数据。
我已将上述每个文件作为外部 jar 导入。然后 我转向https://code.google.com/p/zxing/wiki/DeveloperNotes< /a> 使用 MultiFormatReader()。 无法解析 BufferedImage 类。我尝试了我所知道的一切 我什至尝试了 android 的位图作为解决方法,但它没有帮助 我也是。
我知道我可以使用意图来读取\扫描条形码,但我希望 我自己处理,不要安装“第三方”应用程序。
谁能帮我理解我该怎么做? 只需几行代码即可。
再说一遍,我只想扫描\读取条形码并分析其数据。
I followed every instructions, wiki, getting started, guides, help,
etc. I could find about ZXing project.
After many many debugging, I finally manged to compile using ant
core.jar, javame.jar, and javese.jar.
I would like to integrate ZXing into my code, i.e., I wish to scan
\read a barcode and handle its data.
I've imported as external jar each of the files mentioned above. Then
I turned to https://code.google.com/p/zxing/wiki/DeveloperNotes to use
the MultiFormatReader().
The BufferedImage class cannot be resolved. I tried whatever I know
and I even tried android's Bitmap for a workaround, but it didn't help
me either.
I know I can use an intent to read\scan the barcode, but I wish to
handle it myself and not to install a "3rd party" application.
Can anyone please help me understand how can I do so?
Few lines of code will be appreciated.
And again, I only want to scan\read a barcode and analyze its data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
最简单的答案是您不应该在 Android 应用程序中使用
javase.jar
。它是针对 JavaSE 的代码。并非所有 JavaSE 类都在 Android 中。特别是 Android 没有像 BufferedImage 这样的 AWT 类。您只想在项目中包含
core.jar
。然后使用它编写您的 Android 应用程序。The shortest answer is that you should not use
javase.jar
in an Android app. It is code intended for JavaSE. Not all JavaSE classes are in Android. In particular Android does not have AWT classes likeBufferedImage
.You only want to include
core.jar
in your project. Then write your Android app using it.Jackson 我也建议您按照 inazaruk 建议的方式进行操作。但是,如果您在集成这部分代码时仍然遇到问题(
编辑:
正如 Sean Owen 所说,android 不拥有 BufferedImage 类。您需要导入这些类 &满足他们的依赖。
那么你可以像这样使用它
Jackson I too suggest you the way suggested by inazaruk.But if you are still having issues integrating that part of code (zxing-android).
EDIT:
As stated by Sean Owen android doesn't posses BufferedImage class.You need to import these classes & satisfy their dependency.
Then you may use it like this
以下是我为实验性应用程序所做的操作:
CaptureActivity
,因此它可以更好地与我的应用程序集成。我发现这种方式更简单,因为 Android 在不同设备上统一相机支持方面存在一些问题,ZXing 的人已经解决了这个问题。
Here is what I did for my experimental app:
CaptureActivity
the way I wanted, so its better integrated with my app.I found this way was easier, because Android has some problems with uniform Camera support across different devices, and guys from ZXing already took care of it.
大家好,其实我也陷入了这个问题。但最终我成功地运行了这个项目。当我们下载zxing项目并简单地导入它时,但是由于许多文件丢失而出现了一些错误。
实际上这些文件分布在整个项目中。所以如果你在Zxing-master中搜索这些文件就可以轻松找到。复制这些文件并简单地复制到您的项目中,因为在我的工作区中它是“CaptureActivity”。可能还有一个问题是由于 Java 编译器导致的编译错误而出现的(该项目至少需要 Java 1.7 和 Android OS 4.4)。
无论我在运行这个项目时所知道的是什么,我都会解释。任何疑问请发表评论。
Hi Guys Actually I also stuck in this problem. But finally I run this project successfully. When we download zxing project and simply we import it but there are number for error comes because many file are missing.
Actually these files are distributed in whole projects. So if you search these files in Zxing-master you can find easily. Copy these files and simply copy in your projects as in my workspace it is "CaptureActivity". May be one problem is also come due to compilation error which due to Java Compiler (This project requires atleast Java 1.7 and Android OS 4.4).
Whatever i know when running this project I explained. Any query leave a comment.