什么是错我的Andr​​oidManifest.xml?我的、Andr、xml、oidManifest

2023-09-04 06:12:57 作者:中国辣条协会会长

我试图建立一个基本的应用程序,在2选项卡显示信息,并从我的理解中的每个选项卡中的信息都需要有自己的活动,除了一个用于标签。我已经做到了这一点,所有的Java code看起来正确的,我已经宣布所有3个活动,我AndroidManifest.xml中。当我启动应用程序,它崩溃的开始,当我运行的logcat,我发现:

I am trying to develop a basic app to display information in 2 tabs, and from my understanding the info in each tab needs to have its own activity, in addition to the one for the tabs. I have done this, all of the java code looks right, and I have declared all 3 activities in my AndroidManifest.xml. When I launch the app, it crashes on start, and when I run logcat, I find:

了java.lang.RuntimeException:无法启动活动ComponentInfo {android.wingdom.convention / android.wingdom.convention.TabWidget}:android.content.ActivityNotFoundException:无法找到明确的活动类{android.wingdom.convention /安卓.wingdom.convention.Schedule};有你在你的Andr​​oidManifest.xml宣布这项活动?

java.lang.RuntimeException: Unable to start activity ComponentInfo{android.wingdom.convention/android.wingdom.convention.TabWidget}: android.content.ActivityNotFoundException: Unable to find explicit activity class {android.wingdom.convention/android.wingdom.convention.Schedule}; have you declared this activity in your AndroidManifest.xml?

我一直doublechecking的文件,我看不出什么问题,但目前看起来是这样的:

I keep doublechecking the file, and I dont see anything wrong, it currently looks like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="android.wingdom.convention"
  android:versionCode="1" android:versionName="1.0">

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".TabWidget"
              android:label="@string/app_name"
          android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
<activity android:name=".Map" />
<activity android:name=".Schedule" />
</activity>

</application>

推荐答案

您在定义您的活动活动。

You are defining activities in your activity.

请尝试以下code来代替:

Try the following code instead:

<activity android:name=".TabWidget"
              android:label="@string/app_name"
          android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>
<activity android:name=".Map" />
<activity android:name=".Schedule" />