android.content.ActivityNotFoundException:找不到处理Intent的Activity

时间:2014-10-21 15:12:37

标签: android

我创建了一个名为MyBabyCanRead的新应用 包名称为com.example.claudio.mybabycanread.

当我运行应用程序时,我在logcat中收到错误,我不知道原因:

   10-21 15:42:12.108    1305-1322/com.example.claudio.mybabycanread E/AndroidRuntime﹕ FATAL      EXCEPTION: Thread-165
      android.content.ActivityNotFoundException: No Activity found to handle Intent {  act=com.example.claudio.mybabycanread.MENU }
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
        at android.app.Activity.startActivityForResult(Activity.java:3190)
        at android.app.Activity.startActivity(Activity.java:3297)
        at com.example.claudio.mybabycanread.Splash$1.run(Splash.java:26)

这就是我的清单的样子:

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.claudio.mybabycanread" >
<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="20"/>
<application


    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
     >

    <activity

        android:name=".Splash"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:screenOrientation="portrait"
        android:name=".Menu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MENU" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity

        android:screenOrientation="landscape"
        android:name=".Level1"
        android:label="Level 1">

        <intent-filter>
            <action android:name="com.example.claudio.mybabycanread.LEVEL1" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <activity

        android:screenOrientation="landscape"
        android:name=".Level1T"
        android:label="Level 1 Training">

        <intent-filter>
            <action android:name="com.example.claudio.mybabycanread.LEVEL1T" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>


    <activity
        android:screenOrientation="landscape"
        android:name=".TextToSpeechTest"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.example.claudio.mybabycanread.TEXTTOSPEECHTEST" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
    android:screenOrientation="landscape"
    android:name=".VideoPlayer"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="com.example.claudio.mybabycanread.VIDEOPLAYER" />

        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
  </activity>

  </application>

 </manifest>

这是我的splash.java文件:

package com.example.claudio.mybabycanread;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
/**
* Created by Cl on 9/29/2014.
*/
public class Splash extends Activity {
MediaPlayer ourSong;
@Override
protected void onCreate(Bundle ClaudioFahmy) {
    super.onCreate(ClaudioFahmy);
    setContentView(R.layout.splash);
    ourSong = MediaPlayer.create(Splash.this, R.raw.splashsound);
    ourSong.start();
    Thread timer = new Thread(){
        public void run(){
            try{
                sleep(1000);
            } catch (InterruptedException e){
                   e.printStackTrace();
            }finally{
                Intent Level1 = new Intent("com.example.claudio.mybabycanread.MENU");
                startActivity(Level1);
            }
        }
    };
    timer.start();

}
@Override
protected void onPause() {
    super.onPause();
    ourSong.release();
    finish();
}
}

2 个答案:

答案 0 :(得分:3)

现在我试图成为一个透视者,但是在你的第26行的Splash.java文件中:你已经在该行开始了结果的活动,并且你在意图构造函数中有一个错误的String:类似于..

Intent intent = new Intent("com.example.claudio.maxcanreadattheageof1");
startActivityForResult(intent, 0);

请上传您的清单文件,错误也可能就在那里..

答案 1 :(得分:1)

确保您的清单文件包更新为package=com.example.claudio.mybabycanread