【问题标题】:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project无法解析“:app@debugUnitTest/compileClasspath”的依赖关系:无法解析项目
【发布时间】:2019-09-23 11:39:01
【问题描述】:

我是 Android Studio 的新手,我面临以下错误。

错误:无法解析“:app@debug/compileClasspath”的依赖关系:无法解析项目:floatinglibrary。 显示详细资料 受影响的模块:app

错误:无法解析“:app@debug/compileClasspath”的依赖关系:无法解析项目:datetimepickerlibrary。 显示详细资料 受影响的模块:app

错误:无法解析“:app@debug/compileClasspath”的依赖关系:无法解析项目:BottomBar。 显示详细资料 建造。 Gradle 应用程序 受影响的模块:app

【问题讨论】:

  • 能否请您添加您的 build.gradle

标签: android


【解决方案1】:

您正在使用 3 个库:floatinglibrary、datetimepickerlibrary 和 BottomBar。 但是 gradle 在你告诉它的地方找不到这些库。

在您的 build.gradle 中,您将依赖项定义为 implementation project(:BottomBar):BottomBar 是对库的引用。您还可以在 settings.gradle 文件中找到此引用,您还可以在其中设置文件路径,如下所示:

include ':BottomBar', ':other', ':libraries'

project(':BottomBar').projectDir = new File('the/file/path')

其中“this/file/path”是相对于项目根目录的。

在极少数情况下,AndroidStudio 会因为缓存问题而感到困惑。所以你也可以试试 File -> Invalid Caches 并在 Android Studio 菜单中重启。

另一个原因可以在这里找到:Android studio 3.0: Unable to resolve dependency for :app@dexOptions/compileClasspath': Could not resolve project :animators

【讨论】:

  • 这是您项目文件夹的 build.gradle。而且只有一半。请在您的应用文件夹中发布 build.gradle 的“依赖项”部分。
  • 添加了必需的屏幕截图
  • 请立即查看
  • 嗨,@muetzenfo 是的,您是正确的,该文件夹存在于目录中但未包含在项目中。那么如何将它包含在项目中。有关详细信息,请参阅屏幕截图
  • 我添加了另外两个可能的解决方案:尝试使 Android Studio 的缓存无效。尝试其他 SO 帖子中描述的 gradle 设置。要么是库路径有问题,要么是Android Studio的一些内部缓存问题。
猜你喜欢
  • 1970-01-01
  • 2018-12-04
  • 1970-01-01
  • 1970-01-01
  • 2018-06-26
  • 2018-12-15
  • 2019-04-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多