【发布时间】:2013-10-25 11:23:05
【问题描述】:
我收到了一个 ActivityNotFoundException 的活动,该活动存在并包含在我的应用程序 AndroidManifest.xml 中。
这是我的场景:
我的应用项目包是:com.myapplynx.mytexteditor.android。
我的库项目包是com.myapplynx.mytexteditor.common
我的库项目已正确包含在我的应用程序项目中,因为我可以在我的应用程序项目中使用库项目中的其他类。
活动MyTedAdvancedPreference 位于我的库项目com.myapplynx.mytexteditor.common.prefs 包下。
在我的应用程序项目中,我有一个 xml,res/xml/prefs.xml,我在其中定义了首选项,包括调用 MyTedAdvancedPreference 的首选项屏幕,如下所示:
<PreferenceScreen android:title="@string/config_cat_advanced" >
<intent android:action="android.intent.action.VIEW"
android:targetPackage="com.myapplynx.mytexteditor.android"
android:targetClass="com.myapplynx.mytexteditor.common.prefs.MyTedAdvancedPreferences"/>
请注意,MyTedAdvancedPreferences 包含在我的应用程序项目 AndroidManifest.xml 中:
<application
.....
<activity android:name="com.myapplynx.mytexteditor.common.prefs.MyTedAdvancedPreference"
android:label="@string/title_settings"
android:theme="@style/MyApplynxTheme" >
</activity>
....
</application>
我的应用程序编译并运行正常。因此,当我访问我的设置页面并尝试访问MyTedAdvancedPreference 时,我得到一个ActivityNotFoundException:
10-25 14:15:52.734: E/AndroidRuntime(19049): FATAL EXCEPTION: main
10-25 14:15:52.734: E/AndroidRuntime(19049): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.myapplynx.mytexteditor.android/com.myapplynx.mytexteditor.common.prefs.MyTedAdvancedPreferences}; have you declared this activity in your AndroidManifest.xml?
活动在我的应用程序中定义(com.myapplynx.mytexteditor.android)AndroidManifest.xml。我究竟做错了什么?谢谢。
【问题讨论】:
-
请发布您的整个清单文件。
-
检查构建路径 -> 订购/导出 - 确保私人图书馆被标记为导出
-
嗨,Tomislav,已经完成了。谢谢。
标签: java android xml eclipse android-activity