2017-07-28 44 views
0

我不斷收到錯誤嘗試運行我的應用程序是說,當....閃屏沒有在AndroidManifest.xml活動閃屏沒有在Android清單

任何想法聲明的活動,因爲它是快把我逼瘋了聲明! :-)

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.sjmplanningfinal"> 

    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:roundIcon="@mipmap/ic_launcher_round" 
    android:supportsRtl="true" 
    android:theme="@android:style/Theme.Holo.Light"> 

    <activity android:name="com.example.sjmplanningfinal.SplashScreen"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity android:name="com.example.sjmplanningfinal.SJMPlanningHome" /> 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.DEFAULT" /> 
    </intent-filter> 
+0

它解決了嗎?如果沒有,我會發布我的答案的問題。 – UmarZaii

+0

類別。刪除Main位後,我仍然收到相同的錯誤,但現在我需要解決如何添加應用程序標記?或者在哪裏添加它或添加什麼? – gareth19822002

回答

0

從SJMPlanningHome中刪除標籤action android:name="android.intent.action.MAIN。你宣佈兩項活動爲MAIN。

+0

Doh。這是我的一個基本愚蠢的錯誤。你宣佈其他網頁是什麼,或者你只是刪除整條線? – gareth19822002

+0

刪除整行。但你也錯過標籤... –

+0

非常感謝非常感謝 – gareth19822002

0

每個android應用程序應該已經定義了「應用程序」標籤..作爲清單中的主要標籤,然後在應用程序中定義活動。這裏是清單的結構:你也可以在這裏查看:Manifest structure所有的

<?xml version="1.0" encoding="UTF-8"?> 
<manifest> 
    <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> 
    </application> 
</manifest> 
1
<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.sjmplanningfinal"> 
    <application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:roundIcon="@mipmap/ic_launcher_round" 
    android:supportsRtl="true" 
    android:theme="@android:style/Theme.Holo.Light"> 

    <activity android:name="com.example.sjmplanningfinal.SplashScreen"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity android:name="com.example.sjmplanningfinal.SJMPlanningHome" /> 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.DEFAULT" /> 
    </intent-filter> </application> 

</manifest> 
0

首先,你缺少的application標籤。你以前

android:allowBackup="true" 

把標籤後

<activity android:name="com.example.sjmplanningfinal.SJMPlanningHome"> 

其次,你忘了過濾意圖爲SJMPlanningHome後關閉activity

這是完整的代碼。

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.sjmplanningfinal"> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:roundIcon="@mipmap/ic_launcher_round" 
     android:supportsRtl="true" 
     android:theme="@android:style/Theme.Holo.Light"> 

     <activity android:name="com.example.sjmplanningfinal.SplashScreen"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity android:name="com.example.sjmplanningfinal.SJMPlanningHome"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 
+0

非常感謝你! :-) :-) – gareth19822002