Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

android - ...have you declared this activity in your AndroidManifest.xml

I use an intent to point to next activity but when i click on the button i get the following error.

03-29 11:25:55.414: E/AndroidRuntime(3921): FATAL EXCEPTION: main

**03-29 11:25:55.414: E/AndroidRuntime(3921): android.content.ActivityNotFoundException: 
Unable to find explicit activity class {mycube.test/mycube.test.Compte}; have you declared 
this activity in your AndroidManifest.xml?**

03-29 11:25:55.414: E/AndroidRuntime(3921):     at

 android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)


03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

android.app.Activity.startActivityForResult(Activity.java:2827)


03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

android.app.Activity.startActivity(Activity.java:2933)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at mycube.test.Menu.onClick(Menu.java:143)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

android.view.View.performClick(View.java:2538)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

android.view.View$PerformClick.run(View.java:9152)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

android.os.Handler.handleCallback(Handler.java:587)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

android.os.Handler.dispatchMessage(Handler.java:92)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at android.os.Looper.loop(Looper.java:130)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

android.app.ActivityThread.main(ActivityThread.java:3687)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

java.lang.reflect.Method.invokeNative(Native Method)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

java.lang.reflect.Method.invoke(Method.java:507)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at 

com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)

03-29 11:25:55.414: E/AndroidRuntime(3921):     at dalvik.system.NativeStart.main(Native Method)

However the file exist in my manifest. Did i omit a line in my manifest?

Here is my manifest file.

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="mycube.test"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Light.NoTitleBar" >

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

                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>
        </activity>
    </application>

    <uses-permission android:name="android.permission.INTERNET"></uses-permission>

    <activity  android:name=".Compte"  android:screenOrientation="portrait" />
</manifest>
Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have declared this activity outside application tag.

<activity  android:name=".Compte"  android:screenOrientation="portrait" />

Make it like this :

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Light.NoTitleBar" >

    <activity
        android:name=".Menu" 
        android:screenOrientation="portrait"
        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:name=".Compte"  
         android:screenOrientation="portrait" />

</application>

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...