美文网首页
巧用gradle来切换测试和正式服务器

巧用gradle来切换测试和正式服务器

作者: woodnaonly | 来源:发表于2016-05-23 23:43 被阅读426次

    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学习资料

    相关文章

      网友评论

          本文标题:巧用gradle来切换测试和正式服务器

          本文链接:https://www.haomeiwen.com/subject/miusrttx.html