gradle.propertiees
DEBUG_HOST="http://192.168.1.108"
DEBUG_PAYHOST="http://192.168.1.108:2000"
RELEASE_HOST="http://www.baidu.com"
RELEASE_PAYHOST="http://pay.baidu.com"
bulid.gradle
buildTypes {
debug {
buildConfigField "String", "HOST", DEBUG_HOST
buildConfigField "String", "PAYHOST", DEBUG_HOST
}
release{
buildConfigField "String", "HOST", RELEASE_HOST
buildConfigField "String", "PAYHOST", RELEASE_PAYHOST
}
}
APIURL.java
private static String HOST = BuildConfig.HOST;
private static String PAYHOST = BuildConfig.PAYHOST;
//手机注册发送短信验证码
public static String USER_REGISTER_SEND_MOBILE_CODE = HOST + "/user/register/send/mobile/code";
//手机注册新用户
public static String USER_REGISTER_MOBILE = PAYHOST + "/user/register/mobile";
Gradle学习资料