【问题标题】:Can't iterate over compile dependecies due to support library由于支持库,无法迭代编译依赖项
【发布时间】:2023-04-09 08:17:01
【问题描述】:

我正在尝试支持 eclipse IDE 以使用基于 this link 的 aar

我在尝试迭代编译依赖项时遇到问题

configurations.compile.filter {it.name.endsWith 'jar'}.each { File file -> moveJarIntoLibs(file)}

我明白了

Error:Could not find com.android.support:support-v13:22.1.1.
Searched in the following locations:
file:/C:/Users/myUser/.m2/repository/com/android/support/support-v13/22.1.1/support-v13-22.1.1.pom
file:/C:/Users/myUser/.m2/repository/com/android/support/support-v13/22.1.1/support-v13-22.1.1.jar

Required by:
com.company.project.sdk.android:project:3.0.0-SNAPSHOT

如果我注释了这一行,则构建成功。

另外,我已经安装了支持库。

任何想法如何支持 Eclipse IDE/解决这个问题?

【问题讨论】:

  • 它只搜索了你本地的 m2 文件夹,你有没有尝试添加一个远程依赖仓库,比如 jcenter()mavenCentral()
  • 它可以访问 maven centeral。但正如您可能知道的那样,与 Android 相关的依赖项实际上并不是来自公共存储库。相反,Android Studio 有一个工具来下载所需的 Android 相关依赖项并解决它们。

标签: android eclipse android-gradle-plugin


【解决方案1】:

问题似乎与支持存储库未作为存储库自动包含在内的事实有关。我在Android project issue 69270 中找到了相关问题,并按照建议将本地支持存储库添加为 maven 存储库

repositories {
  def androidHome = System.getenv("ANDROID_HOME")
  mavenCentral()
  maven {
      url "$androidHome/extras/android/m2repository/"
  }
}

现在问题不再出现了。

【讨论】:

  • 有趣,认为问题可能出在其他地方,这解决了症状,但至少它有效(我的任何项目中都没有这个)
  • @Blundell 您是否尝试添加代码来打印您的依赖项? (假设它们包括支持库)
  • 我不确定这对我的情况是否有帮助,因为我想在 gradle 任务中进行迭代。目标是在构建过程中处理部分 jars。
  • 这绝对帮助了我...+1
猜你喜欢
  • 1970-01-01
  • 2019-11-02
  • 1970-01-01
  • 1970-01-01
  • 2021-07-02
  • 2019-06-22
  • 2021-10-20
  • 2019-10-20
  • 2019-11-01
相关资源
最近更新 更多