我正在尝试制作条形码阅读器。我使用这些步骤(Integrating the ZXing library directly into my Android application)来实现它。当我点击我的“StartScan”按钮后,我的应用程序在模拟器上运行后,它显示“不幸的是已停止”。我的logcat中出错了。我无法理解错误是什么。但我认为我的androidmanifest.xml中存在问题请帮助我..
logcat的:
E/AndroidRuntime(957): FATAL EXCEPTION: main
E/AndroidRuntime(957): java.lang.ExceptionInInitializerError
E/AndroidRuntime(957): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime(957): at java.lang.Class.newInstance(Class.java:1319)
E/AndroidRuntime(957): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
E/AndroidRuntime(957): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
E/AndroidRuntime(957): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime(957): at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime(957): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime(957): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(957): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(957): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(957): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(957): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(957): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(957): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(957): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(957): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
E/AndroidRuntime(957): at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:101)
E/AndroidRuntime(957): ... 15 more
我的AndroidManifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.zxing.client.android"
android:versionName="4.3.1"
android:versionCode="87"
android:installLocation="auto"
android:screenOrientation="landscape">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-sdk android:minSdkVersion="15" />
<application
android:label="@string/app_name" >
<activity
android:name="camera.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.zxing.client.android.CaptureActivity"
android:label="ZXing"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</application>
</manifest>