build library ZXing for android project

醉酒当歌 提交于 2019-12-08 03:39:46

问题


hi i want to make QR code scanner to my android app using ZXing library
i already success try it with "Scanning via Intent" method before
now i try different approach

my problem is i always get this error

my step
1. download zxing master from here
2. download jar from repository here
3. import ‘android’ folder from zxing-master in eclipse
4. create libs folder and copy core.jar in there
5. right click in CaptureActivity - properties - java build path - library tab - add core.jar path

i don't know why i still get error after add jar path...
i already try clean project, swith workspace, using latest jar file but still same
any idea?


@update @Nickolai Astashonok

eclipse error '<>' operator is not allowed for source level below 1.7

i try to change java compiler using 1.7 (default 1.6) by
right click project - properties - java compiler tab
but it's seem my target API not fullfil requirment (my API 15)
how to use ZXing in java compiler 1.6?


Update @Sean Owen

when i changed using java compiler level 1.7 and clean project it's says

Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 15

i wanna target my aplication runs for ICS (API 15)
i'm not sure if in 'captureActivity androidManifest using minSDK 19' and 'myProject androidManifest using minSDK 15 will be running well

so i guess i better stick with java compiler 1.6

meanwhile i found this link based on that link i need to use zxing library version 4.5.1 (java compiler 1.6) because version above using java compiler 1.7

but i can't find any download link to 'zxing library version 4.5.1'


回答1:


Your question is not clear, but I think the answer is this: the source code indeed requires Java 7. You simply need to set your IDE project to use Java 7. The supplied Maven build already works correctly in this regard. It is not true that API 15 or any other Android API needs Java 6.




回答2:


I found 4.5.1 but I don't know how to download it! if you figured it out let me know too please. https://code.google.com/p/zxing/source/browse/?r=2927#svn%2Ftrunk%2Fandroid




回答3:


I got the same issue and I solve this by doing:

  1. change the java compiler to 1.7 (like what Nickolai Astashonok suggested)
  2. change the target version to 19 (Android 4.4)
  3. Clean the project again, you will see lots of errors removed but there is still some errors related to missing of CameraConfigurationUtils.java Please go to below link to download and copy the file into your project as per the path suggested.

https://github.com/zxing/zxing/blob/master/android-core/src/main/java/com/google/zxing/client/android/camera/CameraConfigurationUtils.java

  1. Clean the project again, you should be able to clear all the errors and use the sample application in the 'android' folder.


来源:https://stackoverflow.com/questions/24818566/build-library-zxing-for-android-project

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