简体   繁体   中英

My app doesn't show on emulator, when I run the project

when I try to run the project it installs successfully on an emulator, but emulator does not show my app launcher icon in its app menu. but however it shows my app in installed apps in setting>applications>manage applications>all apps , so that means that an app was installed. but it didn't run.

Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thenewboston.travis"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".Splash"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.thenewboston.travis.SPLASH" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name=".Main"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.thenewboston.travis.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Menu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.thenewboston.travis.MENU" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    </application>

     </manifest>

Make sure your starting activity has its intent-filter declared properly in your manifest to be shown in the launcher.

Assuming you want "Splash" to be your main activity change its declaration to this (specifically the intent-filter action)

 <activity
            android:name=".Splash"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
 </activity>

Your intent filter action was not part of the android defaults (and what launchers normally look for). Only launchers that were designed to look for the action "com.thenewboston.travis.SPLASH" would see your activity

 <activity
    android:name=".Splash"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="com.thenewboston.travis.SPLASH" /> //try "android.intent.action.MAIN" here//
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM