Run Android app in debugging mode

My Android Studio version is 2.3.3

In my Android app gradle build, I have explictly defined different server_url string values for debug type and release type:

buildTypes {
        debug {
            resValue "string", "server_url", ""
        release {
            resValue "string", "server_url", ""

In my code, I get the string value by:

String url = context.getString(R.string.server_url);

I connected my Android phone to my laptop. The Android studio toolbar looks like this: enter image description here

I also selected build variants to be “debug”:

enter image description here

I click the enter image description here, the app is running on my phone, however, it uses server_url value defined in release type. Why?

(Under build/generated/res/resValues/debug/generated.xml & build/generated/res/resValues/release/generated.xml I see those values, no problem there eihter.)

==== Update ===

Adding defaultPublishConfig 'debug' fixed the issue (Thanks @Ulug Toprak), but I am still wondering why Android Studio doesn’t work without it though I have set Build Variant to “Debug”. Maybe a bug in Android Studio?


Just to answer your updated question,

Multi module setup (application + android library) will not log annotated methods/classes from Android Library Module but will do it on Android Application Module. The reason behind this, is that the Android Gradle Plugin will build all Android Libraries as release versions.

as suggested in the comments adding defaultPublishConfig "debug" to the build.gradle file will force the debug version