Android - 无法找到默认活动

时间:2017-07-25 19:12:45

标签: java android xml launcher

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

我查看了有关堆栈溢出的现有问题,但没有一个帮助我。我的表现就是这个......

<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>

2 个答案:

答案 0 :(得分:1)

你得到了清单错误的语法。应用程序标记是您保留其中所有活动的标记。

<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>

应用程序标记是所有活动的根标记,而意图过滤器位于活动标记

答案 1 :(得分:0)

所有<activity>...</activity>都应在<application>...</application>中。

在您的清单中,您的<activity>标记位于<application>...</application>之外,而结束标记</activity>位于其中。

这是AndroidManifest.xml结构:

<uses-permission />
<permission />
<permission-tree />
<permission-group />
<instrumentation />
<uses-sdk />
<uses-configuration />  
<uses-feature />  
<supports-screens />  
<compatible-screens />  
<supports-gl-texture />  

<application>

    <activity>
        <intent-filter>
            <action />
            <category />
            <data />
        </intent-filter>
        <meta-data />
    </activity>

    <activity-alias>
        <intent-filter> . . . </intent-filter>
        <meta-data />
    </activity-alias>

    <service>
        <intent-filter> . . . </intent-filter>
        <meta-data/>
    </service>

    <receiver>
        <intent-filter> . . . </intent-filter>
        <meta-data />
    </receiver>

    <provider>
        <grant-uri-permission />
        <meta-data />
        <path-permission />
    </provider>

    <uses-library />

</application>

相关问题