问题
I changed my Launcher activity to a different activity than the default Activity. But when I am running the Application I am not able to start the application. In the logCat it is saying that the application has been installed but I am not able to see the app in the home screen.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.collegehack"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Days"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo" >
<intent-filter>
<action android:name="android.intent.action.DAYS" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo" >
<intent-filter>
<action android:name="com.example.collegehack.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Please tell me where I am going wrong. Thanks in advance.
EDIT Getting the following message in console :
[2015-02-09 02:25:29 - CollegeHack] Android Launch!
[2015-02-09 02:25:29 - CollegeHack] adb is running normally.
[2015-02-09 02:25:29 - CollegeHack] No Launcher activity found!
[2015-02-09 02:25:29 - CollegeHack] The launch will only sync the application package on the device!
[2015-02-09 02:25:29 - CollegeHack] Performing sync
[2015-02-09 02:25:30 - CollegeHack] Automatic Target Mode: Preferred AVD 'Practice' is available on emulator 'emulator-5554'
[2015-02-09 02:25:30 - CollegeHack] Uploading CollegeHack.apk onto device 'emulator-5554'
[2015-02-09 02:25:31 - CollegeHack] Installing CollegeHack.apk...
[2015-02-09 02:25:43 - CollegeHack] Success!
[2015-02-09 02:25:43 - CollegeHack] \CollegeHack\bin\CollegeHack.apk installed on device
[2015-02-09 02:25:43 - CollegeHack] Done!
回答1:
Remove intent filter of Main Activity and put this intent filter to your Days Activity:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
回答2:
Try adding this to your AndroidMainfest.xml file
<activity
android:name=".YourActivityName"> //activty name which you want to launch first
<intent-filter>//this intent code helps you launch activity when the app starts
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
来源:https://stackoverflow.com/questions/28399038/android-manifest-launcher-not-found