Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - app icon for debug and release mode

Is it possible to set separate icons for application if we set android:debuggable=true in manifest and if we set android:debuggable=false like in iOS?

like image 431
LoveMeSomeFood Avatar asked Oct 22 '13 20:10

LoveMeSomeFood


2 Answers

I'm a bit late the party, but anyway. At the moment I'm posting this in '16, you actually can have different launch icon set simply putting them to respective directories, not sure how it was back in '13 though. To achieve that you need to create debug/res directories under app/src and place your mipmap or drawable directories there. So you'll have app/src/main/res/ and app/src/debug/res/ paths. Android will have higher priority for build-related resource directory - to main directory. Place your debug and release resources to the appropriate paths and you'll have what you want. Do all of above considering you have to use Gradle build system.

Here you can read more about stuff like that: http://tools.android.com/tech-docs/new-build-system/resource-merging

like image 160
Alex Berdnikov Avatar answered Oct 12 '22 05:10

Alex Berdnikov


a bit late (actually about 8 years), but while I was browsing DuckDuckGo's Android source code today, I found out that they do it this way:

in your app/build.gradle (DuckDuckGo's app/build.gradle)

android {
    ...
    buildTypes {
        debug {
            ...
            manifestPlaceholders = [
                    appIcon: "@mipmap/ic_launcher_blue",
                    appIconRound: "@mipmap/ic_launcher_blue_round"
            ]
        }
        release {
           ...
            manifestPlaceholders = [
                    appIcon: "@mipmap/ic_launcher_red",
                    appIconRound: "@mipmap/ic_launcher_red_round"
            ]
        }
    }
    ...
}

and in your AndroidManifest.xml just use (DuckDuckGo's AndroidManifest.xml)

<application
     ...
     android:icon="${appIcon}"
     android:roundIcon="${appIconRound}"
     ...
/>
   ...
</application>
like image 6
Adnan Avatar answered Oct 12 '22 05:10

Adnan