Android 找不到com.wix:detox:+;

Android 找不到com.wix:detox:+;,android,firebase,react-native,gradle,detox,Android,Firebase,React Native,Gradle,Detox,尝试在我的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

尝试在我的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 assembleeandroidtest


有什么想法吗?

你有没有尝试过将这个添加到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"
        }
    }
}

我必须更改文档中的url,以匹配解毒模块的实际路径,如下所示:

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}"

希望有帮助。

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

如果你到了这里,请确保将其放在
所有项目
下,而不是
构建脚本

请更详细地改进答案,以便即使是初学者也能理解它。尝试给出代码示例并提前详细说明