解决zxing “Could not find class 'com.goole.zxing.Result”和“Multiple dex files define”问题

时间 2014-04-24 12:29:05  CSDN博客
主题 安卓开发
    刚学android应用程序开发,就遇到扫描二维码功能,比较棘手。goole了下,有个不错的开源库zxing,里面包含了二维码扫描功能。具体怎么使用,csdn上的博客http://blog.csdn.net/xiaanming/article/details/10163203《Android 基于google Zxing实现二维码、条形码扫描,仿微信二维码扫描效果》讲的比较详细,就不赘述了。这里主要分享中间过程遇到的两个问题以及相应的解决方案。 
    一是运行时遇到“Could not find class 'com.goole.zxing.Result'”错误。解决办法如下: 
1、在工程根目录下新建libs文件夹,然后将core.jar粘贴到libs下(我想这一步大家都是做了的); 
2、build path->Libraries->点击Add JARs...(注意不是点击Add External JARs...)->选择你所在的工程->选择第一步新建的libs文件夹->选中第一步我们粘贴的core.jar->点击Ok; 
3、选中libs文件夹->右击,然后选择Build Path->use as source folder。

第一个问题到这里就解决了。你天真的以为就能顺利运行了?错了,程序压根没跑起来。第二个问题来了。

第二个问题是“Unable to execute dex: Multiple dex files define Lcom/google/zxing/BarcodeFormat;”。很多中文blog里都包含解决方法,吧啦吧啦吧啦说了一大推,但是都不起作用。后来在stackoverflow上找到了解决方法(不得不说stackoverflow是一个非常棒的网站),链接地址为:http://stackoverflow.com/questions/7870265/unable-to-execute-dex-multiple-dex-files-define-lcom-myapp-rarray。答案目前已经有156个赞同了。

我用的是链接上的这种方法:In Order and Export tab I did not have any jar library there, so I have unchecked Android Private Libraries item. Now my project is running. 翻译过来就是,Build Path->Order and Export->然后将Android Private Libraries前面那个钩去掉->点击OK。

重新运行,程序工作正常。不过还是遇到了网上同学的问题,扫描的时候要很远才能扫描到二维码,而且感觉扫描不敏感,扫描半天才成功一次,OMG。后续还得花时间把这些问题解决。

Multiple dex files define Lcom/google/zxing/BarcodeFormat的更多相关文章

  1. android开发学习——Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/zxing/BarcodeFormat;

    在Android Studio中,sync project没有错,但是run时会报错; http://blog.csdn.net/q568430333/article/details/50969033 ...

  2. Multiple dex files define Lcom/google/gson/internal/Streams$AppendableWriter$CurrentWrite;

    开发中引入第三方 aar 时编译同过,运行时出现问题: Multiple dex files define Lcom/google/gson/internal/Streams$AppendableWr ...

  3. 解决com.android.dex.DexException: Multiple dex files define Lcom/google/gson/JsonSerializer;

    我在开发Windows Azure的Mobile Service(隔天补上创建过程)的安卓客户端时,报出了com.android.dex.DexException: Multiple dex file ...

  4. Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/adp;

    Q:版本号不对,广告插件的版本号和项目中用的版本号不一致 A:adsplugins的build gradle里面用的版本号是10.0.1,修改app的build gradle 的google类都改成1 ...

  5. Unable to execute dex: Multiple dex files define Lcom/gl

    [2015-04-16 17:42:04 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/gl/softphon ...

  6. Multiple dex files define Lcom/sina/sso/RemoteSSO错误解决办法

    在安卓上遇到了Multiple dex files define Lcom/sina/sso/RemoteSSO的编译错误 在网上找解决办法 搜到了解决办法是这样的 方案1:Eclipse->P ...

  7. unity3d android导出项目编译Multiple dex files define Lcom/unity3d/player/UnityPlayerActivity

    unity3d版本: 4.1.2 在导出android工程进行编译时,发现出现Multiple dex files define Lcom/unity3d/player/UnityPlayerActi ...

  8. Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/lidroid/xutils/task/TaskHandler;

    Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files defi ...

  9. Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;

    Unable to execute dex: Multiple dex files define Lcom/myapp/R$array; 我这个问题最后解决方式是,吧工程里面用同一个v4包. 很明显, ...

随机推荐

  1. 微信小程序 关于底部导航设置

    在app.json 中添加 "tabBar": { "color":"#ffffff", "borderStyle":& ...

  2. 微信签名算法的服务端实现(.net版本)

    一.概要 微信此次开放JS接口,开放了一大批api权限,即使在未认证的订阅号也可以使用图像接口,音频接口,智能接口,地理位置,界面操作,微信扫一扫等功能.要知道:以前订阅号只能接受和被动回复用户消息而 ...

  3. Java Web的传值汇总(含JavaBean)

    前言: 其实JavaBean就像asp.net MVC上的Model传值一样.

  4. BZOJ1572 工作安排 USACO2009

    描述 Description     Farmer John 有太多的工作要做啊!!!!!!!!为了让农场高效运转,他必须靠他的工作赚钱,每项工作花一个单位时间.他的工作日从0时刻开始,有100000 ...

  5. 迅雷9、迅雷极速版之迅雷P2P加速:流量吸血鬼?为什么你装了迅雷之后电脑会感觉很卡很卡?

    原文地址:http://www.whosmall.com/post/90 关闭极速版迅雷ThunderPlatform.exe进程 ThunderPlatform.exe目的:利用P2P技术进行用户间 ...

  6. Yii2.0数据库查询的一些简单的操作

    User::find()->all(); 此方法返回所有数据: User::findOne($id); 此方法返回 主键 id=1 的一条数据(举个例子): User::find()->w ...

  7. Java编程中的美好

    java程序员如何写出"优美"代码,动力节点告诉你怎么办: 1.注释尽可能全面 对于方法的注释应该包含详细的入参和结果说明,有异常抛出的情况也要详细叙述:类的注释应该包含类的功能说 ...

  8. IBatis 2.x 和 MyBatis 3.0.x 的区别(从 iBatis 到 MyBatis)

    从 iBatis 到 MyBatis,你准备好了吗? 对于从事 Java EE 的开发人员来说,iBatis 是一个再熟悉不过的持久层框架了,在 Hibernate.JPA 这样的一站式对象 / 关系 ...

  9. coredump简介与coredump原因总结

    from:http://www.cnblogs.com/doctorqbw/archive/2011/12/21/2295962.html   千兵卫博士   coredump简介与coredump原 ...

  10. nginx图片处理

    前言 不管一个系统或网站的大与小,都存在相应的图片处理,生成缩略图.为图片加水印等等,如果涉及到APP端,这个图片的处理需求变得更加重要了,因为在目前看来,客户端的屏幕大小不一,会导致以下问题: 1. ...