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", "https://myserver.debug.com/"
}
release {
resValue "string", "server_url", "https://myserver.com/"
...
}
}
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:
I also selected build variants to be "debug":
I click the , 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?
USB Debugging mode is a developer mode in Samsung Android phones that allows newly programmed apps to be copied via USB to the device for testing. Depending on the OS version and installed utilities, the mode must be turned on to let developers read internal logs.
To start debugging an APK, click Profile or debug APK from the Android Studio Welcome screen. Or, if you already have a project open, click File > Profile or Debug APK from the menu bar. In the next dialog window, select the APK you want to import into Android Studio and click OK.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With