React native MapBox React Native:';无法解析com.squareup.okio:okio:1.13.0';

React native MapBox React Native:';无法解析com.squareup.okio:okio:1.13.0';,react-native,mapbox-gl,React Native,Mapbox Gl,我尝试安装:但我有以下错误: Could not resolve all files for configuration ':mapbox-react-native-mapbox- gl:debugCompileClasspath'. > Could not resolve com.squareup.okio:okio:1.13.0. Required by: project :mapbox-react-native-mapbox-gl > Cannot find a versi

我尝试安装:但我有以下错误:

Could not resolve all files for configuration ':mapbox-react-native-mapbox- gl:debugCompileClasspath'.
> Could not resolve com.squareup.okio:okio:1.13.0.
Required by:
  project :mapbox-react-native-mapbox-gl
> Cannot find a version of 'com.squareup.okio:okio' that satisfies the version constraints:
    Dependency path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.facebook.react:react-native:0.59.6' --> 'com.squareup.okio:okio:1.15.0'
    Dependency path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okhttp3:okhttp:3.9.1' --> 'com.squareup.okio:okio:1.13.0'
    Dependency path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.facebook.react:react-native:0.59.6' --> 'com.squareup.okhttp3:okhttp:3.9.1' --> 'com.squareup.okio:okio:1.13.0'
    Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
    Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
    Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
    Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0

> Could not resolve com.squareup.okio:okio:1.15.0.
Required by:
  project :mapbox-react-native-mapbox-gl > com.facebook.react:react-native:0.59.6
> Cannot find a version of 'com.squareup.okio:okio' that satisfies the version constraints:
    Dependency path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.facebook.react:react-native:0.59.6' --> 'com.squareup.okio:okio:1.15.0'
    Dependency path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okhttp3:okhttp:3.9.1' --> 'com.squareup.okio:okio:1.13.0'
    Dependency path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.facebook.react:react-native:0.59.6' --> 'com.squareup.okhttp3:okhttp:3.9.1' --> 'com.squareup.okio:okio:1.13.0'
    Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
    Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
    Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
    Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0

> Could not resolve com.squareup.okio:okio:1.13.0.
 Required by:
  project :mapbox-react-native-mapbox-gl > com.squareup.okhttp3:okhttp:3.9.1
> Cannot find a version of 'com.squareup.okio:okio' that satisfies the version constraints:
     Dependency path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.facebook.react:react-native:0.59.6' --> 'com.squareup.okio:okio:1.15.0'
     Dependency path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okhttp3:okhttp:3.9.1' --> 'com.squareup.okio:okio:1.13.0'
     Dependency path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.facebook.react:react-native:0.59.6' --> 'com.squareup.okhttp3:okhttp:3.9.1' --> 'com.squareup.okio:okio:1.13.0'
     Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
     Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
     Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
     Constraint path 'projekt:mapbox-react-native-mapbox-gl:unspecified' --> 'com.squareup.okio:okio' strictly '1.13.0' because of the following reason: debugRuntimeClasspath uses version 1.13.0
我尝试了在网络上找到的解决方案,但没有任何效果

这是我的build.gradle文件:

buildscript {
ext {
    minSdkVersion = 26
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "28.0.0"
}

repositories {
    google()
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    configurations.all { resolutionStrategy { force "com.squareup.okhttp3:okhttp:3.9.1" } } 
    mavenLocal()
    google()
    jcenter()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
 }
}
我尝试了很多事情:抑制节点_模块和npm安装,清理缓存,重新启动所有。。。我确信这是一个react原生版本的问题,但我对gradle是一个新手,我不知道如何为com.squareup修复一个特定的版本

我甚至不知道我是否必须为这个项目修复com.squareup的15或13版本。Downgrad的react本机版本不适合我,我尝试过,但没有任何改变。我在安装时有更多的错误行,现在,我在这一步被阻止了。这是非常令人沮丧的,因为它在这一点上停止了我的项目

你有主意吗


谢谢你的帮助。

在你的
应用程序/build.gradle中试试这个,我曾经遇到过这个问题

compile (project(':@mapbox_react-native-mapbox-gl')) {
    compile ('com.squareup.okhttp3:okhttp:3.6.0') {
        force = true
    }
}
我的root build.gradle(忽略版本号,显然我已经有一段时间没有更新此项目)看起来像:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}
更新

由于OP无法创建build,所以我创建了一个—我就是这样做的。问题是(我也遇到过)当您从github repo Read Me使用npm安装时,由于某些原因,它没有从npm安装正确的SDK版本。因此,我们必须纠正
package.json
以强制从GH url安装

()

运行:

react native init MyProject

转到:package.json和add-in dependencies(位于顶部):

“@mapbox/react-native-mapbox-gl”:https://github.com/nitaliano/react-native-mapbox-gl.git“

npm安装

react本地链接


react native run android

很抱歉回答得太晚,但我花了很长时间尝试应用此解决方案。我有此错误:“无法使用Gradle分发版运行生成操作”。生成文件“D:\Projects\VSCode\projekt\android\app\build.Gradle”行:155评估项目时出现问题:app。在项目中找不到路径为:mapbox\u react-native-mapbox-gl的项目:app。与app/build.Gradle相关的Java(0)”。我试图修复它,但我并不真正理解它的含义。现在我可以编译应用程序,但在我使用mapbox的文件中,我有一个错误:“模块
react native mapbox gl
在Haste模块映射中不存在”,但它出现在依赖项的package.json中:“@mapbox/react native mapbox gl”:“git+”。。。我对mapbox非常着迷,我觉得我离soution很近,但仍然没有任何效果…让我来看看我为您的实现好吧…我不知道为什么,但我回到了最初的错误消息,使用您的解决方案@JRK…我最后的评论:我确认所有工作正常,您救了我的命@JRK!非常感谢你!!!