Android Studio ——How can I modify one Class's field before compile by build.gradle -


in android app i'm developing android studio, have class:

public class config {   public static final string sdk_version = "0.1"; } 

i want modify value of sdk_version field changing file build.gradle:

def sdk_version = "0.1"  android {   defaultconfig {       versionname sdk_version   } } 

how can make value of sdk_version in config.java change automatically when change in build.gradle? otherwise, might change 1 forget change other.

you can example in starter activity in oncreate(), make in not final befor.

config.sdk_version = buildconfig.version_name; 

or why don't use buildconfig.version_name; instead in place constant needed?


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -