第一个问题到这里就解决了。你天真的以为就能顺利运行了?错了,程序压根没跑起来。第二个问题来了。
第二个问题是“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。后续还得花时间把这些问题解决。联系客服