Android: Installed App icon is not visible in emulator

為{幸葍}努か 提交于 2019-12-10 02:09:57

问题


When I run my application code, I could see the following entry in the console:

[2011-03-01 10:29:26 - mireader] Uploading mireader.apk onto device 'emulator-5554'
[2011-03-01 10:29:26 - mireader] Installing mireader.apk...
[2011-03-01 10:29:40 - mireader] Success!
[2011-03-01 10:29:41 - mireader] Starting activity com.mireader.reader on device emulator-5554 
[2011-03-01 10:29:44 - mireader] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mireader/.reader }

The application's main GUI automatically runs. Until here, there is no problem. When I get back to the application list, there my app icon is not visible. I checked in settings->application->manage application, there I could see my app and it shows uninstall option too.

What is the problem?


回答1:


probably missing

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

in your main <activity> in the manifest




回答2:


I had the same problem in Android Studio, with API 19 and with gradle building system. We spent a couple of hours to figure this out, and we realized, if you have more library (for example you have more test app in the same project) and you have more launcher icon in separated library, than gradle cannot solve this. You don't get any error message, just you don't see the icon.

  • So use different names for launcher icon or just delete which you don't need.

(I just thought, maybe someone gonna have the same problem...)

  • There was an other scenario as well, when icon is disappear. When you use <data android:scheme="your-own-uri">

The solution is to split intent-filter.

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="your-own-uri" />
        </intent-filter>
    </activity>



回答3:


Just for Android noobs like myself, putting this:

<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.pdf" />

between the intent filter tags of the main activity also causes an icon disappearing act. The code above is to open a file based on its extension. Remove it and the icon reappears.



来源:https://stackoverflow.com/questions/5150702/android-installed-app-icon-is-not-visible-in-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!