Android Studio (0.3.2) and ZXing

我是研究僧i 提交于 2019-12-01 10:33:44

问题


I cannot get ZXing to work in Android Studio. I have generated the core.jar file using Ant, and the same jar worked fine using Eclipse. Now I must get it working in Android Studio (0.3.2).

Here is what I have tried but to no avail so far:

  • Copy the core.jar file into the PROJECTNAMEProject/PROJECTNAME/libs/
  • Right click > Add as library
  • Choose Project Library as the 'Level' in the Create Library dialog, with 'Add to module' set to the PROJECTNAME folder. I have tried the Global and Module library types as well as Project library.
  • Add compile files('libs/core.jar') to the dependencies section of the PROJECTNAMEProject/PROJECTNAME/build.gradle

The error I'm getting seems to be telling me I'm including the jar twice:

Gradle: UNEXPECTED TOP-LEVEL EXCEPTION: Gradle: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/BarcodeFormat;


回答1:


If you add the compile files('libs/core.jar') to build.gradle, the only other thing you should need to do is click the Sync Project with Gradle Files button in the toolbar.



来源:https://stackoverflow.com/questions/20334572/android-studio-0-3-2-and-zxing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!