创建新模块时,Gradle新的变体感知依赖关系管理的局限性

时间:2018-02-21 17:29:22

标签: android android-studio gradle android-gradle gradle-plugin

我在项目中有多个模块。我尝试在项目中创建一个新模块(Phone& Tablet Module)。但是当Gradle尝试同步时,我收到错误:

Error:(1, 0) Due to a limitation of Gradle’s new variant-aware dependency management, loading the Android Gradle plugin in different class loaders leads to a build error.
This can occur when the buildscript classpaths that contain the Android Gradle plugin in sub-projects, or included projects in the case of composite builds, are set differently.
To resolve this issue, add the Android Gradle plugin to only the buildscript classpath of the top-level build.gradle file.
In the case of composite builds, also make sure the build script classpaths that contain the Android Gradle plugin are identical across the main and included projects.
If you are using a version of Gradle that has fixed the issue, you can disable this check by setting android.enableBuildScriptClasspathCheck=false in the gradle.properties file.
To learn more about this issue, go to https://d.android.com/r/tools/buildscript-classpath-check.html.

我尝试过的一些方法是:

  • 使构建脚本类路径在模块之间相同。
  • 从模块的Gradle中删除所有内容,以便同步。
  • 导入模块而不是创建新模块。

0 个答案:

没有答案