2017-07-25 73 views
0

我正在製作一個基本的自定義啓動器,方法是按照網站上給出的說明進行操作......說明指出該應用程序可以啓動,但是當我嘗試時,出現錯誤說明默認找不到活動。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> 
+0

請檢查活動的拼寫。你好像拼錯了兩次。也許錯誤是由於這個。 – Abhi

+0

謝謝......但仍然無法正常工作......同樣的錯誤... – Azzler

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

應用程序標記是所有活動的根標籤和意圖過濾去行動標籤

+0

如果您早點關閉它,結尾標記怎麼樣? – Azzler

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>