我正在研究the barcode scanner example并且一直在模拟器上正常工作。但是当我将它加载到我的机器人2上时,当我点击“扫描代码”按钮时它会崩溃。以下是logcat中的错误。我错过了什么?
01-12 14:40:36.200 2962 2962 E AndroidRuntime: FATAL EXCEPTION: main
01-12 14:40:36.200 2962 2962 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mds.tutorial.ca/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassNotFoundException: com.google.zxing.client.android.CaptureActivity in loader dalvik.system.PathClassLoader[/data/app/com.mds.tutorial.ca-1.apk]
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1618)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at android.app.ActivityThread.access$1500(ActivityThread.java:124)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at android.os.Looper.loop(Looper.java:123)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:3806)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:507)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: com.google.zxing.client.android.CaptureActivity in loader dalvik.system.PathClassLoader[/data/app/com.mds.tutorial.ca-1.apk]
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-12 14:40:36.200 2962 2962 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1610)
感谢。
这是我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mds.tutorial.ca"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application android:debuggable="true" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity android:configChanges="orientation|keyboardHidden" android:name=".CaActivity"
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.phonegap.DroidGap" android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
</intent-filter>
</activity>
<!-- ZXing activities -->
<activity android:name="com.google.zxing.client.android.CaptureActivity" android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity" android:label="@string/share_name">
<intent-filter>
<action android:name="com.phonegap.plugins.barcodescanner.ENCODE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
答案 0 :(得分:1)
似乎dalvik无法找到你的班级。确保清单文件中的启动活动包定义正确。如果正确,我会从手机上完全卸载应用程序并重新安装。