0

我正在尝试制作条形码阅读器。我使用这些步骤(将 ZXing 库直接集成到我的 Android 应用程序中)来制作它。当我单击“StartScan”按钮时,我的应用程序在模拟器上运行后,它显示“不幸已停止”。我的 logcat 出现错误。我不明白出了什么问题。但我认为我的 androidmanifest.xml 有问题请帮助我..

日志猫:

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>
4

0 回答 0