解决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. Css-深入学习之弧形切角矩形

    本文是作者从别的网站和文章学习了解的知识,简单做了个笔记,想要学习更多的可以参考这里:[css进阶]伪元素的妙用--单标签之美,奇思妙想 (弧形切角矩形) 代码: width: 180px; heig ...

  2. Asp.Net MVC<六>:Controller、Action 待续

    控制器 抽象类Controller Visual Studio的向导创建的Controller类型继承自抽象类Controller. 它是ControllerBase的子类. 实现了IControll ...

  3. 【codevs1515】 跳

    http://codevs.cn/problem/1515/ (题目链接) 题意 给出一个棋盘,规定走到(x,y)的花费C(x,y)=C(x-1,y)+C(x,y-1),x=0或y=0时C(x,y)= ...

  4. Linux 查找文件并删除文件内容

    find * ./ |while read file; do echo ''>$file; done

  5. DialogFragment is gone after returning back from another activity

    基本情景如下: 在DialogFragment中单击一个按钮跳转到another Activity做一些逻辑处理,然后将返回的结果回显到该DialogFragment上. 处理逻辑是: 在Dialog ...

  6. Alpha阶段第十次Scrum Meeting

    情况简述 Alpha阶段第十次Scrum Meeting 敏捷开发起始时间 2016/11/3 00:00 敏捷开发终止时间 2016/11/4 00:00 会议基本内容摘要 详细定义了API接口,汇 ...

  7. J2EE web项目中解决所有路径问题

    Java中使用的路径,分为两种:绝对路径和相对路径.归根结底,Java本质上只能使用绝对路径来寻找资源.所有的相对路径寻找资源的方法,都不过是一些便利方法.不过是API在底层帮助我们构建了绝对路径,从 ...

  8. BZOJ4285: 使者

    搞出dfs序,转化为查询矩形点数,树套树搞定. #include<cstdio> #include<cstdlib> #define N 100005 #define IF e ...

  9. C#内存管理与垃圾回收

    垃圾回收还得从根说起,就像生儿育女一样. 根:根是一个位置,存放一个指针,该指针指向托管堆中的一个对象,或是一个空指针不指向任何对象,即为null.根存在线程栈或托管堆中,大部分的跟都在线程栈上,因为 ...

  10. OpenGL Common Mistakes

    https://www.opengl.org/wiki/Common_Mistakes Do not use constructors/destructors to initialize/destro ...