androidxmlandroid-studioreleasegraphical-logo

App Logo shows in debug apk but not in release apk | Android


So I have been working to add a logo to my app in android studio. I did it via right click on mipmap folder -> new -> Image Asset -> Selecting image asset -> next -> finish. After this my mipmap folder looks like the below image: mipmap folder screenshot I can clearly see that there is debug written on all the images added by me.

Now whenever I build a signed apk and select release mode the logo does not show up in the app but in debug mode it does. Please help me out and let me know how I can have the logo show up in release build as well.

For your refrence I am adding my Manifest and build.gradle files:

build.gradle file looks like this

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace 'com.nomaanh.deliveryappcommissioncalculator'
    compileSdk 32

    defaultConfig {
        applicationId "com.nomaanh.deliveryappcommissioncalculator"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures{
        viewBinding true
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}

And my AndroidManifest.xml file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.DeliveryAppCommissionCalculator"
        tools:targetApi="31">
        <activity
            android:name=".GetMoneyActivity"
            android:exported="false">
            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>
        <activity
            android:name=".IncreaseMoneyActivity"
            android:exported="false">
            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>
        <activity
            android:name=".AdjustCommissionActivity"
            android:exported="false">
            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>
    </application>

</manifest>

I tried deleting the release ic_launcher.xml/ic_launcer_round.xml but that brought up some linking error while building the app, I also tried changing the foreground property to my logo in the files itself but that also didnt help.


Solution

  • You probably missed Res Directory selection step in Android studio while adding the image asset. Here's how you need to add the app icon for both debug and release build in Android Studio:-

    right click on mipmap folder -> new -> Image Asset -> Selecting image asset -> next -> Click on Dropdown menu in front of Res Directory -> Select main as an option ->finish

    Image asset for debug and release