插件中开发使用TabHost控件,Tab项是多个Activity,在宿主中调用改插进会出现ActivityNotFoundException
发布于 2 年前 作者 446525753 954 次浏览 来自 问答

你好,我在一个插件的主界面放置一个按钮,点击跳到插件中的另一个使用TabHost控件的Activity,在宿主中调用,跳转到插件主界面,再点击按钮,会出现ActivityNotFoundException,必须在宿主的Manifest.xml文件中注册TabHost中的多个Activity,才能正常,请问这个问题怎么解决,能不能不在宿主中注册?

2 回复

您的情况好像是插件的那个TabHost Activity没有找到,请将你的异常日志贴出来一下

02-17 18:45:39.521 30613-30613/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.meappkitdemo, PID: 30613 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.meappkitdemo/org.apkplug.app.apkplugActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.meappkitdemo/com.plugindemo2.hardware}; have you declared this activity in your AndroidManifest.xml? at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3254) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) at android.app.ActivityThread.access$1100(ActivityThread.java:222) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7237) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.meappkitdemo/com.plugindemo2.hardware}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1854) at android.app.ActivityThread.resolveActivityInfo(ActivityThread.java:2948) at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:286) at org.tengxin.dO.startActivity(Unknown Source) at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:764) at android.widget.TabHost.setCurrentTab(TabHost.java:423) at android.widget.TabHost.addTab(TabHost.java:257) at com.plugindemo2.SubActivity.onCreate(SubActivity.java:47) at android.app.Activity.performCreate(Activity.java:6876) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) at org.tengxin.e.callActivityOnCreate(Unknown Source) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)  at android.app.ActivityThread.access$1100(ActivityThread.java:222)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:158)  at android.app.ActivityThread.main(ActivityThread.java:7237)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)  02-17 18:45:39.521 3488-3505/? W/ActivityManager: Force finishing activity com.meappkitdemo/org.apkplug.app.apkplugActivity

回到顶部