您好,欢迎来到伴沃教育。
搜索
您的当前位置:首页依赖module中BuildConfig.DEBUG值为fals

依赖module中BuildConfig.DEBUG值为fals

来源:伴沃教育

项目中想用BuildConfig.DEBUG判断环境,debug模式下依赖module中BuildConfig中代码如下

public static final boolean DEBUG = Boolean.parseBoolean("true");

但得到的值一直为false,最后在stackoverflow上找到了解决方法

被依赖的module中添加:例如library下

android { 
        publishNonDefault true
}

APP下添加:

dependencies { 
   releaseCompile project(path: ':library', configuration: 'release')                                  
   debugCompile project(path: ':library', configuration: 'debug')
}

Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务