...你宣布你的Andr​​oidManifest.xml本次活动你的、Andr、xml、oidManifest

2023-09-12 22:32:52 作者:一丢丢可爱

我用一个意图指向下一个活动,但是当我点击的按钮,我碰到下面的错误。

  11月3号至29号:25:55.414:E / AndroidRuntime(3921):致命异常:主要
\
** 11月3号至29号:25:55.414:E / AndroidRuntime(3921):android.content.ActivityNotFoundException:
无法找到明确的活动类{mycube.test / mycube.test.Compte};你声明
本次活动在你的Andr​​oidManifest.xml?**

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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


11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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


11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在mycube.test.Menu.onClick(Menu.java:143)

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在android.os.Looper.loop(Looper.java:130)

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

java.lang.reflect.Method.invokeNative(本机方法)

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在

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

11月3日至29号:25:55.414:E / AndroidRuntime(3921):在dalvik.system.NativeStart.main(本机方法)
 

不过该文件存在于我的表现。它是一个Eclipse问题,或者我ommitted在我的清单行?请帮忙。这是我的清单文件。

 < XML版本=1.0编码=UTF-8&GT?;

<舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    包=mycube.test
    安卓版code =1
    机器人:VERSIONNAME =1.0>

    <用途-SDK
        安卓的minSdkVersion =8
        机器人:targetSdkVersion =17/>

    <应用
        机器人:图标=@可绘制/ ic_launcher
        机器人:标签=@字符串/ APP_NAME
        机器人:主题=@安卓风格/ Theme.Light.NoTitleBar>

        <活动
            机器人:菜单名称=
            机器人:screenOrientation =画像
            机器人:标签=@字符串/ APP_NAME>
            <意向滤光器>

                <作用机器人:名称=android.intent.action.MAIN/>
                <类机器人:名称=android.intent.category.LAUNCHER/>

            &所述; /意图滤光器>
        < /活性GT;
    < /用途>

    <使用-权限的Andr​​oid:名称=android.permission.INTERNET对>< /使用-许可>

    <活动机器人:孔特名称=机器人:screenOrientation =画像/>
< /舱单>
 

解决方案

您已经对外宣称应用程序标签这一活动。

 <活动机器人:孔特名称=机器人:screenOrientation =画像/>
 

请它是这样的:

 <应用
    机器人:图标=@可绘制/ ic_launcher
    机器人:标签=@字符串/ APP_NAME
    机器人:主题=@安卓风格/ Theme.Light.NoTitleBar>

    <活动
        机器人:菜单名称=
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ APP_NAME>
        <意向滤光器>
             <作用机器人:名称=android.intent.action.MAIN/>
             <类机器人:名称=android.intent.category.LAUNCHER/>
        &所述; /意图滤光器>

    < /活性GT;

    <活动
         机器人:孔特NAME =
         机器人:screenOrientation =画像/>

< /用途>

<使用-权限的Andr​​oid:名称=android.permission.INTERNET对>< /使用-许可>
 

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. Is it an eclipse problem or i ommitted a line in my manifest ? Please help. 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>

解决方案

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>