React-native 依赖错误(com.atlassian.mobile.video okhttp-ws-compat)

React-native dependency error (com.atlassian.mobile.video okhttp-ws-compat)

我正在开发 React-native 应用程序,突然出现以下错误:

  • What went wrong: A problem occurred configuring project ':app'. Could not resolve all dependencies for configuration ':app:_debugApk'. A problem occurred configuring project ':react-native-config'. Could not resolve all dependencies for configuration ':react-native-config:_debugPublishCopy'. Could not find com.atlassian.mobile.video:okhttp-ws-compat:3.7.0-atlassian1. Required by: cabm8:react-native-config:unspecified > com.facebook.react:react-native:0.42.3-atlassian-1

我摆脱了模块 react-native-config 但仍然面临类似的错误:

  • What went wrong: A problem occurred configuring project ':app'. Could not resolve all dependencies for configuration ':app:_debugApk'. A problem occurred configuring project ':react-native-maps'. Could not resolve all dependencies for configuration ':react-native-maps:_debugPublishCopy'. Could not find com.atlassian.mobile.video:okhttp-ws-compat:3.7.0-atlassian1. Required by: cabm8:react-native-maps:unspecified > com.facebook.react:react-native:0.42.3-atlassian-1

这个问题似乎与 com.atlassian.mobile.video:okhttp-ws-compat:3.7.0-atlassian1 有某种关系。

我尝试重新安装 node_modules,删除文件夹 androidios,然后使用 git 恢复它们。我还能尝试什么?

同样的问题,查看了源代码但在任何地方都找不到对 "atlassian" 的引用,所以我关闭了 wifi(以查看是否正在进行任何调用以获取外部资源)并得到了正在关注

Could not resolve all dependencies for configuration ':react-native-google-analytics-bridge:_debugPublishCopy'. Could not resolve com.atlassian.mobile.video:okhttp-ws-compat:3.7.0-atlassian1. Required by: OneUps:react-native-google-analytics-bridge:unspecified > com.facebook.react:react-native:0.42.3-atlassian-1 Could not resolve com.atlassian.mobile.video:okhttp-ws-compat:3.7.0-atlassian1. Could not get resource 'https://jcenter.bintray.com/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.pom'.

如果你按照那个 link 看起来那个包已经被删除了,我猜这是导致问题的原因?

com.atlassian.mobile.video 目前在 Maven 上不可用。要 运行 您的项目,您需要更新它

reactreact-native 版本更新到 package.json 文件

"react": "16.0.0-alpha.3",
"react-native": "0.43.1",

然后删除 node_modules 并再次执行 npm install

让我知道它是否适合你

在您的 build.gradle 中(不在 android/app/build.gradle 中)添加此行以强制所有对 react-native 的依赖到特定版本:

allprojects {

    configurations.all {
        resolutionStrategy {
            eachDependency { DependencyResolveDetails details ->
                if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
                    details.useVersion "0.39.0" // Your real React Native version here
                }
            }
        }
    }
...
}

这个配置对我有用。我希望这会有所帮助。

仅供参考,此处跟踪了此错误:https://github.com/facebook/react-native/issues/14225

我能够通过指定 reactreact-native 的以下版本来修复:

  • "react": "15.4.1",
  • "react-native": "0.42.3"

https://github.com/oblador/react-native-vector-icons/issues/480#issuecomment-304471394

在您的根 build.Gradle 中强制所有依赖项到特定版本。

allprojects {
 configurations.all {
   resolutionStrategy {
     eachDependency { DependencyResolveDetails details ->
       if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
         details.useVersion "0.40.0" // Your React Native version here
       }
     }
   }
 }
  }

将此添加到 build.gradle(不在 app/build.gradle)文件夹中的 android 文件中。你不想手动添加 react-native 版本。

allprojects {
    configurations.all {
        resolutionStrategy {
            eachDependency { DependencyResolveDetails details ->
                if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
                    def file = new File("$rootDir/../node_modules/react-native/package.json")
                    def version = new groovy.json.JsonSlurper().parseText(file.text).version
                    details.useVersion version
                }
            }
        }
    }
}

我认为这会有所帮助。