简体   繁体   English

运行项目时,我的应用程序未在模拟器上显示

[英]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) 假设您希望“ Splash”成为您的主要活动,请将其声明更改为此(特别是intent-filter操作)

 <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). 您的意图过滤器动作不是android默认值(以及启动程序通常查找的内容)的一部分。 Only launchers that were designed to look for the action "com.thenewboston.travis.SPLASH" would see your activity 只有设计为寻找动作“ com.thenewboston.travis.SPLASH”的启动器才会看到您的活动

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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