开发者

Android application icon not showing up

开发者 https://www.devze.com 2023-02-06 20:46 出处:网络
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 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开发者_StackOverflow社区 why it isn't showing up?


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>


  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.


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"


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


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!


For displaying icons you need to replace the @drawable in the theme style and it will work

Android application icon not showing up


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.


Add this:

android:roundicon also


<manifest ...>

    <application
        android:icon="..."
        android:roundIcon="..."/>
</manifest>

In application of manifest of your app there are two attributes, icon & roundicon. one is for debug and another is for release.


In my case after assigning both ic_launcher and ic_launcher_round in all mipmap folders I had to remove the following folder "mipmap-anydpi-v26" in order to show app Icon.


in intent filter tag only action and category are allow not others tag. if any wrong tag in intent filter tag then you can not open and see your application in mobile phone.

<intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
<!--                <action android:name="android.intent.action.SENDTO" />-->
<!--                <data android:scheme="mailto" />-->
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
0

精彩评论

暂无评论...
验证码 换一张
取 消