找不到 com.google.zxing.ResultMetadataType 异常解决

在 https://github.com/zxing/zxing 下载二维码扫描

将 android 导入,code打成jar包运行时 报

06-14 23:43:08.690: E/AndroidRuntime(7761): FATAL EXCEPTION: main
06-14 23:43:08.690: E/AndroidRuntime(7761): java.lang.ExceptionInInitializerError
06-14 23:43:08.690: E/AndroidRuntime(7761):  at java.lang.Class.newInstanceImpl(Native Method)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at java.lang.Class.newInstance(Class.java:1429)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at android.os.Looper.loop(Looper.java:123)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at java.lang.reflect.Method.invokeNative(Native Method)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at java.lang.reflect.Method.invoke(Method.java:521)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:863)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:621)
06-14 23:43:08.690: E/AndroidRuntime(7761):  at dalvik.system.NativeStart.main(Native Method)
06-14 23:43:08.690: E/AndroidRuntime(7761): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
06-14 23:43:08.690: E/AndroidRuntime(7761):  at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:107)
06-14 23:43:08.690: E/AndroidRuntime(7761):  ... 15 more

解决

在eclipse中    Properties -> Java Build Path -> "Order and Export"

在Order and Export选项卡中将core.jar提前到第一位 并选中它 

然后clean你的工程,这一步非常重要,千万别忘记了。

重新编译运行就可以了

 

原文:http://www.cnblogs.com/elena76/p/3553900.html?utm_source=tuicool

 http://blog.sina.com.cn/s/blog_67d95f400100z9f4.html

你可能感兴趣的:(Google)