因此,我正在尝试将其实现到我的应用程序中,但是问题是它无法作为单独的应用程序使用,因此它会破坏我启动它的evrytime.我确实按照后面的教程http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/进行操作,但是它不起作用.因此,我尝试将captureActivity作为应用程序而不是库启动,并且尝试启动时会在启动时崩溃:
private static final Set<ResultMetadataType> DISPLAYABLE_METADATA_TYPES =
EnumSet.of(ResultMetadataType.ISSUE_NUMBER,
ResultMetadataType.SUGGESTED_PRICE,
ResultMetadataType.ERROR_CORRECTION_LEVEL,
ResultMetadataType.POSSIBLE_COUNTRY);
这就导致了我没有正确编译core.jar的问题.但是我看不到我会在哪里做错.我在核心目录中运行ant -f,它给了我core.jar.任何想法我该怎么办?
编辑:logcat:
01-06 02:07:08.280: E/AndroidRuntime(1629): FATAL EXCEPTION: main
01-06 02:07:08.280: E/AndroidRuntime(1629): java.lang.ExceptionInInitializerError
01-06 02:07:08.280: E/AndroidRuntime(1629): at java.lang.Class.newInstanceImpl(Native Method)
01-06 02:07:08.280: E/AndroidRuntime(1629): at java.lang.Class.newInstance(Class.java:1409)
01-06 02:07:08.280: E/AndroidRuntime(1629): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-06 02:07:08.280: E/AndroidRuntime(1629): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
01-06 02:07:08.280: E/AndroidRuntime(1629): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-06 02:07:08.280: E/AndroidRuntime(1629): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-06 02:07:08.280: E/AndroidRuntime(1629): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-06 02:07:08.280: E/AndroidRuntime(1629): at android.os.Handler.dispatchMessage(Handler.java:99)
01-06 02:07:08.280: E/AndroidRuntime(1629): at android.os.Looper.loop(Looper.java:130)
01-06 02:07:08.280: E/AndroidRuntime(1629): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-06 02:07:08.280: E/AndroidRuntime(1629): at java.lang.reflect.Method.invokeNative(Native Method)
01-06 02:07:08.280: E/AndroidRuntime(1629): at java.lang.reflect.Method.invoke(Method.java:507)
01-06 02:07:08.280: E/AndroidRuntime(1629): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-06 02:07:08.280: E/AndroidRuntime(1629): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-06 02:07:08.280: E/AndroidRuntime(1629): at dalvik.system.NativeStart.main(Native Method)
01-06 02:07:08.280: E/AndroidRuntime(1629): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
01-06 02:07:08.280: E/AndroidRuntime(1629): at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:107)
01-06 02:07:08.280: E/AndroidRuntime(1629): ... 15 more
01-06 02:07:08.740: E/GoKeyboard(1442): error setSuggestions isNotInput()!
01-06 02:07:09.140: E/GoKeyboard(1442): error setSuggestions isNotInput()!
01-06 02:07:11.600: E/GoKeyboard(1442): error setSuggestions isNotInput()!
01-06 02:07:11.600: E/GoKeyboard(1442): error setSuggestions isNotInput()!
现在我从这里下载了核心http://mvnrepository.com/artifact/com.google.zxing/core/2.0并使用它并窃取了相同的错误,因此它一定是其他东西…
解决方法:
转到属性-> Java构建路径-> “订购和出口”
然后将core.jar订购到第一个位置并选择它!
您必须在操作后清理项目.项目->清洁
那解决了问题.我希望它可以节省别人的时间.