weixin_44143858
weixin_44143858
采纳率66.7%
2019-01-31 16:08

在模拟器运行的时候出错,提示Unfortunately,XXX has stopped

<?xml version="1.0" encoding="utf-8"?>
package="com.example.textqrcode"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.VIBRATE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".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:configChanges="orientation|keyboardHidden"
        android:name="com.zxing.activity.CaptureActivity"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateAlwaysHidden" >
    </activity>
</application>


01-31 07:52:24.090: E/AndroidRuntime(695): FATAL EXCEPTION: main
01-31 07:52:24.090: E/AndroidRuntime(695): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.textqrcode/com.example.textqrcode.CaptureActivity}; have you declared this activity in your AndroidManifest.xml?
01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.Activity.startActivityForResult(Activity.java:3190)
01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.Activity.startActivity(Activity.java:3297)
01-31 07:52:24.090: E/AndroidRuntime(695): at com.example.textqrcode.MainActivity$1.onClick(MainActivity.java:26)
01-31 07:52:24.090: E/AndroidRuntime(695): at android.view.View.performClick(View.java:3480)
01-31 07:52:24.090: E/AndroidRuntime(695): at android.view.View$PerformClick.run(View.java:13983)
01-31 07:52:24.090: E/AndroidRuntime(695): at android.os.Handler.handleCallback(Handler.java:605)
01-31 07:52:24.090: E/AndroidRuntime(695): at android.os.Handler.dispatchMessage(Handler.java:92)
01-31 07:52:24.090: E/AndroidRuntime(695): at android.os.Looper.loop(Looper.java:137)
01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.ActivityThread.main(ActivityThread.java:4340)
01-31 07:52:24.090: E/AndroidRuntime(695): at java.lang.reflect.Method.invokeNative(Native Method)
01-31 07:52:24.090: E/AndroidRuntime(695): at java.lang.reflect.Method.invoke(Method.java:511)
01-31 07:52:24.090: E/AndroidRuntime(695): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-31 07:52:24.090: E/AndroidRuntime(695): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-31 07:52:24.090: E/AndroidRuntime(695): at dalvik.system.NativeStart.main(Native Method)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • cjwyc timorwu 2年前

    你程序调用的是com.example.textqrcode.CaptureActivity这个Activity而你的AndroidManifest.xml里面加的是com.zxing.activity.CaptureActivity,前面包名不一致。

    点赞 评论 复制链接分享

相关推荐