我的扫描条形码的应用程序工作正常,但是当我在扫描时按下菜单按钮崩溃。
logcat如下
05-16 20:58:56.186:E / AndroidRuntime(8240):致命异常:主要 05-16 20:58:56.186:E / AndroidRuntime(8240):android.content.ActivityNotFoundException:无法找到显式活动类{com.mds.mytmt3 / com.google.zxing.client.android.PreferencesActivity};你有没有在AndroidManifest.xml中声明这个活动? 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405) 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.app.Instrumentation.execStartActivity(Instrumentation.java:1379) 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.app.Activity.startActivityForResult(Activity.java:2827) 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.app.Activity.startActivity(Activity.java:2933) 05-16 20:58:56.186:E / AndroidRuntime(8240):at com.google.zxing.client.android.CaptureActivity.onOptionsItemSelected(CaptureActivity.java:320) 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.app.Activity.onMenuItemSelected(Activity.java:2205) 05-16 20:58:56.186:E / AndroidRuntime(8240):at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:748) 05-16 20:58:56.186:E / AndroidRuntime(8240):at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143) 05-16 20:58:56.186:E / AndroidRuntime(8240):at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855) 05-16 20:58:56.186:E / AndroidRuntime(8240):at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532) 05-16 20:58:56.186:E / AndroidRuntime(8240):at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122) 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.view.View $ PerformClick.run(View.java:9080) 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.os.Handler.handleCallback(Handler.java:587) 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.os.Handler.dispatchMessage(Handler.java:92) 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.os.Looper.loop(Looper.java:123) 05-16 20:58:56.186:E / AndroidRuntime(8240):在android.app.ActivityThread.main(ActivityThread.java:3683) 05-16 20:58:56.186:E / AndroidRuntime(8240):at java.lang.reflect.Method.invokeNative(Native Method) 05-16 20:58:56.186:E / AndroidRuntime(8240):at java.lang.reflect.Method.invoke(Method.java:507) 05-16 20:58:56.186:E / AndroidRuntime(8240):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:839) 05-16 20:58:56.186:E / AndroidRuntime(8240):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 05-16 20:58:56.186:E / AndroidRuntime(8240):at dalvik.system.NativeStart.main(Native Method)
我的清单文件看起来像这样
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mds.mytmt3"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<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:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity android:configChanges="orientation|keyboardHidden"
android:name=".MyPhoneGapActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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>
我到处搜索如何向清单声明android.preferencesactivity,但我无处可去。
任何帮助表示感谢。