小编Rot*_*rak的帖子

无法使用`debugImplementation 'androidx.fragment:fragment-testing:'+fragment_version` 作为依赖来运行应用程序

我是安卓新手。

我正在用 Java 开发。

我的目标是在我的测试框架中使用 FragmentScenraio。

在我发现的指南中,我看到我需要添加:

dependencies {
    def fragment_version = "1.2.2"
    // ...
    debugImplementation 'androidx.fragment:fragment-testing:$fragment_version'
}
Run Code Online (Sandbox Code Playgroud)

对我的依赖。

我正在添加它并且项目成功构建。

问题是,当我在 Android Studio 中运行应用程序时,我得到了

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:preDebugAndroidTestBuild'.
> Could not resolve all task dependencies for configuration ':app:debugAndroidTestRuntimeClasspath'.
   > Could not resolve androidx.test:core:1.3.0-alpha04.
     Required by:
         project :app
         project :app > androidx.test:core-ktx:1.3.0-alpha04
         project :app > androidx.test.ext:junit:1.1.2-alpha04
         project :app > androidx.test.espresso:espresso-intents:3.3.0-alpha04
      > Cannot find a version of 'androidx.test:core' …
Run Code Online (Sandbox Code Playgroud)

java android android-studio build.gradle android-espresso

6
推荐指数
1
解决办法
1979
查看次数