build.gradle 936 B

123456789101112131415161718192021222324252627282930313233343536
  1. allprojects {
  2. repositories {
  3. google()
  4. mavenCentral()
  5. }
  6. }
  7. rootProject.buildDir = "../build"
  8. subprojects {
  9. //======添加下边代码解决部分库没有在build.gradle里设置namespace的问题======
  10. afterEvaluate { project ->
  11. if (project.plugins.hasPlugin("com.android.application") ||
  12. project.plugins.hasPlugin("com.android.library")) {
  13. project.android {
  14. compileSdkVersion 34
  15. buildToolsVersion "34.0.0"
  16. }
  17. }
  18. if (project.hasProperty("android")) {
  19. project.android {
  20. if (namespace == null) {
  21. namespace project.group
  22. }
  23. }
  24. }
  25. }
  26. //============
  27. project.buildDir = "${rootProject.buildDir}/${project.name}"
  28. project.evaluationDependsOn(":app")
  29. }
  30. tasks.register("clean", Delete) {
  31. delete rootProject.buildDir
  32. }