ActivityNotFoundException(是的,这个活动是在AndroidManifest.xml中声明) [英] ActivityNotFoundException (YES, this activity is declared in AndroidManifest.xml)

查看:610
本文介绍了ActivityNotFoundException(是的,这个活动是在AndroidManifest.xml中声明)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找了几个线程报告了类似的问题,但<一个href="http://stackoverflow.com/questions/3180459/activitynotfoundexception-for-an-activity-declared-in-my-androidmanifest-xml">none他们真的提供的东西,我没有尝试。

I found a few threads reporting a similar problem but none of them really offers something that I haven't tried already.

这是无辜的,例如呼叫:

An innocent such call:

mActivity.startActivity(new Intent(mActivity, MyEditPreferences.class));

在AndroidManifest.xml中如下:

with the following in AndroidManifest.xml:

 <application>
    <activity android:name="MyActivityLib" />
    <activity android:name="com.example.baseapp.MyEditPreferences" android:label="@string/app_name">
    </activity>
 </application>

触发以下异常:

Triggers the following exception:

06-14 14:06:50.297: ERROR/AndroidRuntime(9272): 
android.content.ActivityNotFoundException: Unable to find explicit activity class
{com.example.baseapp.paypal/com.example.baseapp.MyEditPreferences};
have you declared this activity in your AndroidManifest.xml?

的事情是,这个code用完美的工作之前,我改变了它从一个单一的应用项目,是从库项目和应用项目由二部分组成的项目。

The things is, this code used to work flawlessly before I changed it from a monolithic application project to a 2-part project that is comprised from a Library Project and an Application Project.

在AndroidManifest.xml中是一个在的项目。

The AndroidManifest.xml is the one in the library project.

什么我需要做消除这种 ActivityNotFoundException

What do I need to do eliminate this ActivityNotFoundException?

推荐答案

我刚刚解决了这个问题。

I just solved the problem.

我所要做的就是在FQN添加到应用程序项目的的Andr​​oidManifest.xml

All I had to do was add the FQN to the Application project's AndroidManifest.xml:

<activity android:name="com.example.baseapp.MyEditPreferences"
          android:label="com.example.baseapp.MyActivityLib:string/app_name">
</activity>

其实,我删除了在项目的的Andr​​oidManifest.xml <任何参考 myedit在preferences / code>完全,它仍然有效。

In fact, I removed any reference to MyEditPreferences in the Library project's AndroidManifest.xml completely and it still works.

它也与原来的startActivity 1行语句:

It also works with the original startActivity 1-line statement:

mActivity.startActivity(new Intent(mActivity, MyEditPreferences.class));

结论:这是应用程序的的Andr​​oidManifest.xml 的事项,而不是库的

Conclusion: It's the application's AndroidManifest.xml that matters, not the library's.

这篇关于ActivityNotFoundException(是的,这个活动是在AndroidManifest.xml中声明)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆