Android application icon not showing up

Deadly 提交于 2019-12-18 12:53:37

问题


I've just spent numerous hours constructing an icon for an Android app I'm working on, but can't get it to show up for the app in the emulator.

I've put it in res/drawable-hdpi, res/drawable-mdpi, res/drawable-ldpi in the respective sizes as defined in http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html

The manifest contains the line:

 <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">

Any ideas as to why it isn't showing up?


回答1:


  1. Make sure the icon is stored with the name icon.png in those folders.
  2. Make sure android has a drawable/icon resource. Check this by looking at your gen/R.java file and seeing public static final int icon = 0x.... in the drawable inner class.
  3. Try cleaning your project build and uninstalling any existing version of your app from your phone/emulator and then reinstall the new version.



回答2:


Notice Win Myo Htet's comment on the accepted answer. He solved my problem.

Jems since your answer has so much vote, can you add the following pointer too: Make sure that intent-filter for MAIN and LAUNCHER is not mixed with other intent-filter. – Win Myo Htet Dec 6 '15 at 5:47

"mixed" being the keyword. I had intent in my AndroidManifest.xml file that was there to prevent all file types from being available in file selects. While it began with the second answer's solution, it contained the extra intent for the file selects. This prevented Android from installing my icons when installing the app. I wanted to post this in case anyone else ran into this issue since Win My Htet's brilliant advice could easily be missed since it is essentially one word "mixed"




回答3:


Make sure that the Intent of your Launcher Activity is named MAIN i.e,

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

Moreover, add the icon to your Drawable folders and then refer it in the application block of Manifest.

<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >



回答4:


I would like to elaborate on the answers of @Britton Pentakill and @arnav bhartiya because I could solve my problem using their answers. I added more actions on my MainActivity because Android Studio was complaining that "App not indexable by Google" and I also wanted it to be indexable.

Wrong AndroidManifest.xml:

<intent-filter>
  <action android:name="android.intent.action.MAIN"/>
  <category android:name="android.intent.category.LAUNCHER"/>
  <action android:name="android.intent.action.SEND"/>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="https"
        android:host="siara.cc"
        android:pathPrefix="/CrossCalc" />
 </intent-filter>

So when I published my app, people could not find my App Icon on their device, no Open button after installing on Play console, even if it did pass review and published on play store (it took 7 days).

Then when I read their answers, I corrected and now I am able to see the icon for opening my app:

Correct:

<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="https"
    android:host="siara.cc"
    android:pathPrefix="/CrossCalc"/>
</intent-filter>



回答5:


If you are running on Android 5.0, just add these lines into the onCreate method, inside MainActivity:

getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.drawable.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);

It might help in your case.




回答6:


I had a similar problem recently and I eventually found out there were two causes:

  • File extension: To stay on the safer side, always stick to .png format. Some other formats actually work on certain devices (e.g using a .jpg icon still showed up on my Infinix note 4 phone) but .png files are guaranteed to work on all devices.

  • Storage location: Your icon file should be in the drawable folder. Remember to do a double check as to whether your manifest file points to the place you saved your drawable too.

I hope this helps.. Merry coding!




回答7:


Add this:

android:roundicon also


来源:https://stackoverflow.com/questions/4776933/android-application-icon-not-showing-up

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