0

I have a flutter app in which I have generated app icons for under the android folder of the project with the image asset tool that comes with android studio. On certain versions of android however neither this icon or flutter's default icon displays which seems to tell me this isn't just an issue with the icons I've provided, I instead get the default green android as such:

enter image description here

enter image description here

The screenshots above have come from an android 5 emulator (albeit quite old now its still technically supported by flutter so I wanted to test this) and I get the same problems on a physical device running android 7, but the icon seems to appear fine on any versions above. Something else I have noticed is that no app name appears in the multitasking menu but I'm not sure if that is a completely unrelated issue.

If anyone could help me that would be great, as I can't figure out what other icons I need to place in the project as I thought I'd covered all options. Thanks.

Edit- This is the android manifest for my app:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="me.letalis.testapp">
   <application
        android:label="Test App"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

Res folder:

enter image description here

KompjoeFriek
  • 3,572
  • 1
  • 22
  • 35
Letal1s
  • 47
  • 2
  • 9

1 Answers1

0

Follow these Steps to Change/Customize Launcher Logo in Android Studio,

*Expand the project root folder in the Project View

*Right Click on the app folder

*In the Context Menu go to New->Image Asset

*In the pop up that appears select the the new logo you would like to have(image/clip art/text).

*If you were selecting the image radio button (as is the default choice), if you clicked on the 3-buttons to show the path tree to locate your .png image file, most probably you might not be seeing it, so drag it from the Windows Explorer (if Windows) and drop it in the tree, and it will appear and ready for being selected.

**Don't forget to set new icon's location in manifest: replace drawable to minimap in android:icon –

..........Mipmap Solution: enter image description here As you can see this Snapshot, I set Mipmap for every version, you can follow this also, You have to create an XML file for anydpi-v26

`<?xml version="1.0" encoding="utf-8"?>


<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>`
ahmednawazCS
  • 128
  • 12
  • I've already completed the 'new -> image asset' process and all the folders in my 'res' are filled with the new custom images. On some versions of android this works fine, although in other versions neither this or the default flutter icon shows (as per my main post) so I don't think its an issue with making the image but maybe some configuration? As for replacing drawable to minimap in the manifest do you mean mipmap? If so I've got that in my manifest too. – Letal1s May 11 '21 at 18:17
  • For Adaptive icon For Flutter Please see go through this thread.. [link](https://stackoverflow.com/questions/50778020/can-i-use-android-8-0-adaptive-icons-for-a-flutter-app) .. – ahmednawazCS May 11 '21 at 18:32
  • I have updated answer too for your ease .. :) – ahmednawazCS May 11 '21 at 18:33
  • Okay so I checked the thread and looked at the second method just in case something had gone wrong when I used the image asset creation tool, but the only difference I can find between the thread and my project is that mine doesn't appear to have a 'ic_launcher_foreground.xml'. I also added android:roundIcon="@mipmap/ic_launcher_round" to my manifest but it doesn't seem to have made a difference. The screenshot you provided does look like its structured differently to the one generated on mine though so I'll update the post to include mine too. Does anything look off? – Letal1s May 11 '21 at 19:02
  • Ok quick update, I think I've solved it. For some reason the create new image asset tool isn't creating legacy icons despite being under the option for both adaptive and legacy icons. After copying and pasting the ic_launcher_foreground images and naming them ic_launcher this seemed to fix the issue as I was missing them. Thanks a lot :) – Letal1s May 11 '21 at 20:21
  • that is great :) ,,,,I did not observe this before that "ic_launcher" is missing in all mipmap folders except in anydpi-v26 ... you can simply add one file with "ic_launcher" name and put back "ic_launcher_foreground" as it before.. Anyhow Issue has been resolved :) – ahmednawazCS May 11 '21 at 20:27
  • If you find this answer helpful/useful then please repute it select it as answer , Thanks! – ahmednawazCS May 11 '21 at 20:29