Skip to main content

If the Android app icon is not changing from the default icon (in my situation this was the Capacitor icon), here are some steps to troubleshoot and resolve the issue:

 

Check the Icon Files

Ensure that you have provided the correct icon files in the appropriate directory. In a Capacitor project, the Android app icon should be placed in the res directory under various density-specific folders (e.g., mipmap-hdpi, mipmap-mdpi, mipmap-xhdpi, etc.).

 

Verify File Names

Check that the icon files are named correctly.  The default icon filenames are usually ic_launcher.png for the app icon and ic_launcher_foreground.png for the foreground icon (adaptive icons).  Make sure you have replaced these files with your custom icons and that they have the same names.

 

Clear the Build Cache

Sometimes, Android Studio or Gradle may cache resources.  Try cleaning and rebuilding the project, and then run the app again.

 

Update the Configuration

Ensure that your Capacitor configuration (usually capacitor.config.json) is correctly configured with the updated app icon path and filename.  You can specify the icon file in the android section of the configuration:

"android": {
 "iconPath": "path/to/your/icon.png"
}

 

Check AndroidManifest.xml

Open the android/app/src/main/AndroidManifest.xml file and make sure that the icon name is set correctly:

<application
   android:icon="@mipmap/ic_launcher"
   ...
>

 

Check the res directory

Try removing out of the app the following two files

  • ic_launcher_round.xml
  • ic_launcher.xml

Location: android/app/src/main/res/mipmap-anydpi-v26

 

Test on a Physical Device

Sometimes, the Android emulator may not reflect icon changes immediately. Try testing your app on a physical Android device to ensure the icon change is working as expected.

 

Ensure Proper Icon Resolution

Verify that you have provided icons for various screen resolutions (e.g., mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi) if needed.  For example, my screen resolutions are:

hdpi-background.png
hdpi-foreground.png
mdpi-background.png
mdpi-foreground.png
xhdpi-background.png
xhdpi-foreground.png
xxhdpi-background.png
xxhdpi-foreground.png
xxxhdpi-background.png
xxxhdpi-foreground.png

 

Rebuild the App

Make sure you rebuild your Android app after making any changes to the icons or configuration. You can do this using the following command:

npx cap copy android

 

Check for Errors

Review the Android Studio console for any errors related to missing or incorrect icon files. This can provide more specific information on what might be going wrong.

 

Related articles

Andrew Fletcher24 Oct 2023
How to generate a new private key (.pepk)
How to generate a new private key and submit it to Google Play for signing your Android app, you can follow these steps:Generate a New Keystore (Private Key)You can generate a new keystore file (which includes the private key) using the keytool utility that comes with the Java Development Kit (JDK)....