allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = "../build" subprojects { //======添加下边代码解决部分库没有在build.gradle里设置namespace的问题====== afterEvaluate { project -> if (project.plugins.hasPlugin("com.android.application") || project.plugins.hasPlugin("com.android.library")) { project.android { compileSdkVersion 34 buildToolsVersion "34.0.0" } } if (project.hasProperty("android")) { project.android { if (namespace == null) { namespace project.group } } } } //============ project.buildDir = "${rootProject.buildDir}/${project.name}" project.evaluationDependsOn(":app") } tasks.register("clean", Delete) { delete rootProject.buildDir }