被依赖的项目对外提供默认release版本
此设置更改默认行为
android {
publishNonDefault true
}
依赖设置
dependencies {
//使用release版本
releaseCompile project(path: ‘:library’, configuration: ‘release’)
//使用debug版本
debugCompile project(path: ‘:library’, configuration: ‘debug’)
}
debug版本判断
/**
* Sync lib debug with app’s debug value. Should be called in module Application
*
* @param context
*/
public static void syncIsDebug(Context context) {
if (isDebug == null) {
isDebug = context.getApplicationInfo() != null &&
(context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}
}
Android使用被依赖的library工程的Debug版本
最新推荐文章于 2021-02-24 19:11:46 发布