【问题标题】:Could not find any matches for com.wix:detox:+找不到 com.wix:detox:+ 的任何匹配项
【发布时间】:2020-04-16 06:44:47
【问题描述】:

尝试在我的 android 设备上运行 detox 并遇到以下错误:

> Configure project :react-native-firebase
react-native-firebase: using React Native prebuilt binary from /Users/m/Desktop/alohapass-business/node_modules/react-native/android

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileStagingDebugAndroidTestJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:stagingDebugAndroidTestCompileClasspath'.
   > Could not find any matches for com.wix:detox:+ as no versions of com.wix:detox are available.
     Required by:
         project :app

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s

我的build.gradle 中有androidTestImplementation('com.wix:detox:+') { transitive = true },并且正在运行./gradlew assembleAndroidTest

有什么想法吗?

【问题讨论】:

    标签: android firebase react-native gradle detox


    【解决方案1】:

    您是否尝试将其添加到 android/build.gradle 中?

    // Note: add the 'allproject' section if it doesn't exist
    allprojects {
        repositories {
            // ...
            google()
            maven {
                // All of Detox' artifacts are provided via the npm module
                url "$rootDir/../node_modules/detox/Detox-android"
            }
        }
    }
    

    【讨论】:

      【解决方案2】:

      我不得不更改文档中的 url,以匹配 Detox 模块的真实路径,如下所示:

      allprojects {
          repositories {
              google()
              maven {
                  // All of Detox' artifacts are provided via the npm module
                  url "$rootDir/node_modules/detox/Detox-android"
              }
              println  "rootDir: ${rootDir}"
          }
      }
      

      尝试验证rootDir的实际路径是什么,看看你是否也需要这样做。

      您可以通过在 Gradle 文件中添加以下行来打印它:

      println "rootDir: ${rootDir}"
      

      希望对你有帮助。

      【讨论】:

        【解决方案3】:

        如果你到了这里,请确保你把它放在allprojects 而不是buildscript

        【讨论】:

        • 请更详细地改进答案,以便初学者也能理解它。尝试提供代码示例并详细说明
        【解决方案4】:

        是的,两个答案都指示我修复节点模块包的路径。从 Detox 文档复制代码会给我错误的包路径。

        【讨论】:

          猜你喜欢
          • 2019-05-11
          • 2019-05-12
          • 1970-01-01
          • 2018-12-25
          • 1970-01-01
          • 2019-12-01
          • 1970-01-01
          • 2013-06-30
          • 1970-01-01
          相关资源
          最近更新 更多