android


BuildConfig.DEBUG always return flase


BuildConfig.DEBUG always return flase , when i was run application?
i use it to control the log like this
public static void d(String LOG_TAG,String msg){
if(BuildConfig.DEBUG){
Log.d(LOG_TAG,msg);
}
}
In you Android Studio build variant are you on debug variant ?
If that code is in a library, then it'll always be false, thanks to a 3-year-old bug in gradle.
There is a workaround for the problem:
App
dependencies {
releaseCompile project(path: ':library', configuration: 'release')
debugCompile project(path: ':library', configuration: 'debug')
}
Library
android {
publishNonDefault true
}
Perhaps not ideal, but I ended up creating my own
buildTypes {
debug {
buildConfigField "boolean", "IS_DEBUG", "true" // Had issues with BuildConfig.DEBUG, created IS_DEBUG to ensure functionality behaved as expected.
}
release {
signingConfig signingConfigs.release
buildConfigField "boolean", "IS_DEBUG", "false"
}
}
And then address it like BuildConfig.IS_DEBUG programatically.
Check imports in the class you are using this BuildConfig. May be you are using BuildConfig not from your app, but from some library.

Related Links

How to pass context from activity to activity?
Is there any advantage to using a certificate authority when creating certificates for android code signing?
How to get Uri of res folder?
ViewFlipper with a variable number of liniar layout
Android Store something in Application Context
Android, Is there any protocol to bypass developers from taking and sending User Name and Password?
Custom dynamic graph in Android
Can i use TDD in android developing process?
android simulator showing black screen sound only when playing video
How can I create a android service for listen a server?
onSaveInstanceState saving state of ImageButton
Compare button text
NetBeans+Android: after update i have error: build.xml:77: Android Target is not set
Strange Behavior When Populating EditText field
Android - Shared Preferences are lost sometimes
Which development toolset should I use for an Android slate?

Categories

HOME
service-worker
hyperlink
dns
object
angular-formly
flex
package
vscode-extensions
tail
onclick
data-visualization
gluon-mobile
elasticsearch-5
computer-science
rcloud
jquery-ui-sortable
dkim
reactive-programming
enthought
google-form
automatic-ref-counting
coin3d
alpacajs
google-picker
squashfs
cgbitmapcontext
mongoid6
draft-js-plugins
custom-post-type
angularjs-components
apktool
8051
android-things
user-defined-functions
bioinformatics
finagle
autodesk-designautomation
xbox
scatter3d
python-2.6
dst
memory-address
html-encode
slacktextviewcontroller
getlasterror
google-knowledge-graph
bc
plaintext
plr
ssrs-2014
dapper-simplecrud
optimizely
vaadin-elements
ntvs
mschart
facebook-pixel
trojan
corruption
singleinstance
backbone-collections
avx
skin
arules
check-mk
oozie-coordinator
gameplay-kit
cudd
actor-platform
preprocessor
appscale
redis-cluster
piracy-prevention
toast
custom-errors
sql-server-data-tools
liquid-layout
entity-framework-4.3
grouping-sets
execve
ghcjs
renderer
koala
mysql-error-1044
mbunit
ebay-lms
gpars
pagedown
cascadingdropdown
mysql-error-2013
twisted.web
pdfviewer
usertype
luabind
strsep
cdonts
opml
pagemethods
data-mapping
image-capture

Resources

Encrypt Message