MapBox React Native: «Не удалось разрешить com.squareup.okio: okio: 1.13.0» - PullRequest
0 голосов
/ 03 мая 2019

Я пытаюсь установить: MapBox , но у меня есть эти ошибки:

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

Я перепробовал много вещей: подавить установку node_modules и npm, очистить кеш, перезапустить все ... Я уверен, что это проблема с реактивной версией, но я новичок в gradle и не понимаю, как исправить определенную версию для com.squareup.

Я даже не понимаю, должен ли я исправить версию 15 или 13 com.squareup для проекта. Даунград, реагирующая родная версия меня не радует, я попробовал и ничего не изменилось. У меня было намного больше строк ошибок при установке, и теперь я заблокирован на этом этапе. Это очень расстраивает, потому что на этом этапе мой проект останавливается.

У вас есть идея?

Спасибо за вашу помощь.

1 Ответ

1 голос
/ 03 мая 2019

Попробуйте это в своем app/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 не может создать сборку, я создал ее - так я и сделал.Проблема в том (что я тоже сталкивался), когда вы используете npm install из github repo Read Me, по какой-то причине он не устанавливает правильную версию SDK из NPM.Поэтому мы должны исправить package.json для принудительной установки с URL-адреса GH

(https://github.com/nitaliano/react-native-mapbox-gl/issues/1602)

Run:

react-native init MyProject

Goto: package.json и добавить в зависимости (вверху):

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

run

npm install

react-native link

react-native run-android

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...