【问题标题】:Failed to resolve: com.android.support.test:testing-support-lib:0.1无法解决:com.android.support.test:testing-support-lib:0.1
【发布时间】:2017-12-11 03:49:50
【问题描述】:

我已经按照here 的说明在另一个项目中使用了 AndroidJUnitRunner。

现在我正在尝试在另一个项目中使用它,但我遇到了问题。

我补充说:

testCompile('com.android.support.test:testing-support-lib:0.1') {
    exclude group: 'junit'  // junit:junit-dep conflicts with junit:unit
}

发生的情况是 Android Studio 显示错误:

无法解决:com.android.support.test:testing-support-lib:0.1

并要求我安装一个新软件包。我接受并显示:

Loading SDK information...
Refresh Sources:
  Fetched Add-ons List successfully
  Refresh Sources

Installing Archives:
  Preparing to install archives
  Installing Android Support Repository, revision 15
    Installed Android Support Repository, revision 15
  Done. 1 package installed.

但是当我尝试同步时,我又遇到了同样的错误

无法解决:com.android.support.test:testing-support-lib:0.1

AS 要求我重新安装它。

我检查了这个包已经安装了。

【问题讨论】:

  • com.android.support.test:testing-support-lib:0.1 已替换为 com.android.support.test:rules:0.3。见github.com/commonsguy/cw-omnibus/tree/master/Testing/JUnit4
  • 但在另一个项目上它仍然有效
  • 我担心这与我没有使用 apply "plugin: 'com.android.application'" 这一事实有关,正如您从 "testCompile" 而不是 "androidTestCompile" 中看到的那样。我现在正在检查它
  • "I'm not using apply "plugin: 'com.android.application'"" -- 嗯,你需要使用com.android.applicationcom.android.library,否则尝试没有意义使用 Android 的仪器测试。

标签: android unit-testing


【解决方案1】:

复制您的评论@CommonsWare,只是为了快速访问。

com.android.support.test:testing-support-lib:0.1 已被替换为 com.android.support.test:rules:0.3

See github.com/commonsguy/cw-omnibus/tree/master/Testing/JUnit4

【讨论】:

    猜你喜欢
    • 2019-03-27
    • 2019-03-29
    • 2018-11-07
    • 2020-08-23
    • 2018-12-26
    • 2018-09-17
    • 1970-01-01
    • 1970-01-01
    • 2018-11-07
    相关资源
    最近更新 更多