Android - 无法找到默认活动
问题描述:
我正在制作一个基本的自定义启动器,方法是按照网站上给出的说明进行操作......说明指出该应用程序可以启动,但是当我尝试时,出现错误说明默认找不到活动。Android - 无法找到默认活动
我研究了关于堆栈溢出的现有问题,但没有人帮助我。我的清单是这样的...
<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>
答
您得到了错误语句的语法错误。应用程序标签是您保留所有活动的标签。
<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>
应用程序标记是所有活动的根标签和意图过滤去行动标签
+0
如果您早点关闭它,结尾标记 application>怎么样? – Azzler
答
所有<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>
请检查活动的拼写。你好像拼错了两次。也许错误是由于这个。 – Abhi
谢谢......但仍然无法正常工作......同样的错误... – Azzler
请正确粘贴清单。你已经把一个标签应用放在一个标签活动中......这是我第一次看到类似的东西。 –