java - Android - 找不到默认 Activity

标签 java android xml launcher

我正在按照网站上给定的说明制作一个基本的自定义启动器...该说明说可以启动该应用程序,但是当我尝试时,我收到一条错误消息,指出未找到默认 Activity 。

我研究了有关堆栈溢出的现有问题,但没有一个对我有帮助。我的 list 是这样的...

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="omg_its_azzler.launcher">

  <activty>
    <application android:allowBackup="true"
        android:name="omg_its_azzler.launcher.HomeActivity"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
        android:launchMode="singleTask"
        android:stateNotNeeded="true"/>

    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.HOME"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
  </activty>

  <activity>
    android:name="omg_its_azzler.launcher.AppsActivity"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
  </activity>
</manifest>

最佳答案

您的 list 语法错误。应用程序标签是您在其中保存所有 Activity 的标签。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="omg_its_azzler.launcher">
    <application android:allowBackup="true"
        android:name="omg_its_azzler.launcher.HomeActivity"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
        android:launchMode="singleTask"
        android:stateNotNeeded="true"/>


    <activity>
        android:name="omg_its_azzler.launcher.AppsActivity"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
    <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.HOME"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>
</application>

应用程序标签是所有 Activity 的根标签, Intent 过滤器位于 Activity 标签内部

关于java - Android - 找不到默认 Activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45311741/

相关文章:

java - 无法恢复 Android 默认音乐播放器

java - 需要帮助来读取文本文件

java - 使用 jar 时抛出异常

android - 如何在 Android Studio 中查看项目的当前依赖项列表?

android - 切换到 OpenGL 会提高渲染速度吗?

java - 在 Spring 配置中,用 XML 格式编写 Java 代码有什么好处?

c# - 如何在 C# 中切换 XML XDocument XElement 中的属性

java - 如何将资源 ID 传递给自定义 View 并指示哪个 subview 使用它?

java - 在 Android 5 最近屏幕中更改 Activity 的标题/标签

java - fragment 中的维基图像识别