【问题标题】:ActivityNotFoundException: unable to find explicit activity class . android.content.ClipData$Item missingActivityNotFoundException: 无法找到明确的活动类。 android.content.ClipData$Item 丢失
【发布时间】:2012-10-18 13:09:46
【问题描述】:

我的 logcat 显示

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.storemanager/android.content.ClipData$Item}; have you declared this activity in your AndroidManifest.xml?

我的意图是这样的

Intent intent = new Intent(CategoryMain.this, Item.class);
intent.putExtra("childData", childDataMap);
startActivity(intent);

Android Manifest 就像

<activity android:name="CategoryMain" >
        </activity>
        <activity android:name="Item" >
        </activity>

找到this的问题,提到可能是由于下一个活动中的一些空指针异常,我尝试调试它但调试器没有移动到下一个活动。 请告诉我哪里错了?

编辑:我已经尝试将“Item”更改为“.Item”

已解决:在尝试了每一种方法之后,我终于意识到我的 android manifest 没有问题。问题在于下一个活动中的oncreate 方法中的nullpointerexception

【问题讨论】:

  • 尝试给出完整路径 com.example.storemanager.CategoryMain
  • 你确定你的Item.java在你的包里com.example.storemanager
  • 是 Item.java 在同一个包中。
  • 尝试清理您的项目并运行它。而且,告诉我您是否使用任何.jar 外部文件?而且,一旦尝试this
  • 我尝试的第一件事是清理我的项目。没有使用外部 .jar 文件!

标签: android android-intent android-activity


【解决方案1】:

试试这个

<activity 
android:name=".CategoryMain" >
        </activity>
        <activity android:name=".Item" >
        </activity>

【讨论】:

  • 检查您的项目活动可能是该活动的问题
  • 确实在我的项目活动中有一个空指针异常。非常感谢 。接受你的回答。
【解决方案2】:

Fully Qualified class Name是个好习惯

<activity 
   android:name="com.example.storemanager.CategoryMain" >
    </activity>
    <activity android:name="com.example.storemanager.Item" >
    </activity>

【讨论】:

  • 仍然得到 09-27 04:27:05.400: E/AndroidRuntime(2763): android.content.ActivityNotFoundException: 找不到明确的活动类 {com.example.storemanager/android.content.ClipData $项目};您是否在 AndroidManifest.xml 中声明了此活动?
  • 您在项目中使用了任何外部 jars
  • 不!我没有使用任何外部罐子。
  • this 链接可能会对您有所帮助。检查一下
【解决方案3】:

试试这个 -

......
......
<activity android:name=".CategoryMain" />
<activity android:name=".Item" />
......
......

更新

你有没有尝试过用完整的包来声明你的活动?

<activity android:name="com.example.storemanager.Item />
......

【讨论】:

    【解决方案4】:

    由于上面的答案都不起作用,我觉得Item这个名字有点可疑,因为android使用了item标签。尝试将活动名称更改为 ItemActivity。
    我只是猜测。

    【讨论】:

      猜你喜欢
      • 2017-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多