问一下 当运行android app的时候,程序报错:
但是 在androidmanifest.xml已经定义了呀,
<activity
android:name=”com.example.emedicine.MainfaceActivity” >
</activity>>
//–
而对于MainfaceActivity在这个文件的:
public class MainfaceActivity extends FragmentActivity implements OnTabSelectedListener {
。
。
}
12-24 16:09:31.716: E/AndroidRuntime(1142): Process: com.example.emedicine, PID: 1142
12-24 16:09:31.716: E/AndroidRuntime(1142): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.emedicine/com.example.emedicine.MainfaceActivity}; have you declared this activity in your AndroidManifest.xml?
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1648)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1442)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Activity.startActivityForResult(Activity.java:3516)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Activity.startActivityForResult(Activity.java:3477)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Activity.startActivity(Activity.java:3719)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Activity.startActivity(Activity.java:3687)
12-24 16:09:31.716: E/AndroidRuntime(1142): at com.example.emedicine.StartActivity$1.run(StartActivity.java:22)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.os.Handler.handleCallback(Handler.java:733)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.os.Handler.dispatchMessage(Handler.java:95)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.os.Looper.loop(Looper.java:157)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.ActivityThread.main(ActivityThread.java:5387)
12-24 16:09:31.716: E/AndroidRuntime(1142): at java.lang.reflect.Method.invokeNative(Native Method)
12-24 16:09:31.716: E/AndroidRuntime(1142): at java.lang.reflect.Method.invoke(Method.java:515)
12-24 16:09:31.716: E/AndroidRuntime(1142): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
12-24 16:09:31.716: E/AndroidRuntime(1142): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
12-24 16:09:31.716: E/AndroidRuntime(1142): at dalvik.system.NativeStart.main(Native Method)
12-24 16:09:34.741: I/Process(1142): Sending signal. PID: 1142 SIG: 9
但是 在androidmanifest.xml已经定义了呀,
<activity
android:name=”com.example.emedicine.MainfaceActivity” >
</activity>>
//–
而对于MainfaceActivity在这个文件的:
public class MainfaceActivity extends FragmentActivity implements OnTabSelectedListener {
。
。
}
12-24 16:09:31.716: E/AndroidRuntime(1142): Process: com.example.emedicine, PID: 1142
12-24 16:09:31.716: E/AndroidRuntime(1142): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.emedicine/com.example.emedicine.MainfaceActivity}; have you declared this activity in your AndroidManifest.xml?
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1648)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1442)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Activity.startActivityForResult(Activity.java:3516)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Activity.startActivityForResult(Activity.java:3477)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Activity.startActivity(Activity.java:3719)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.Activity.startActivity(Activity.java:3687)
12-24 16:09:31.716: E/AndroidRuntime(1142): at com.example.emedicine.StartActivity$1.run(StartActivity.java:22)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.os.Handler.handleCallback(Handler.java:733)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.os.Handler.dispatchMessage(Handler.java:95)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.os.Looper.loop(Looper.java:157)
12-24 16:09:31.716: E/AndroidRuntime(1142): at android.app.ActivityThread.main(ActivityThread.java:5387)
12-24 16:09:31.716: E/AndroidRuntime(1142): at java.lang.reflect.Method.invokeNative(Native Method)
12-24 16:09:31.716: E/AndroidRuntime(1142): at java.lang.reflect.Method.invoke(Method.java:515)
12-24 16:09:31.716: E/AndroidRuntime(1142): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
12-24 16:09:31.716: E/AndroidRuntime(1142): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
12-24 16:09:31.716: E/AndroidRuntime(1142): at dalvik.system.NativeStart.main(Native Method)
12-24 16:09:34.741: I/Process(1142): Sending signal. PID: 1142 SIG: 9
解决方案
10
还是路径的问题,直接写这个 .MainfaceActivity 试试看
10
不行把 manifest.xml 文件贴出来看看
20
看看还有没有别的错误提示
5
没找到就说明在AndroidManifest.xml中没有定义,假如定义了,可能是包名和实际Activity所在包名不一致。
5
你应该是为了兼容3.0以前的版本而导入了v7还是v4包吧,本人印象中导入了哪一个包之后是不能直接继承fragmentactivity的