map-ir/mapir-react-native-sdk

android error in dependency : okhttp3, squareup, appcompat , ...

hamid opened this issue · 2 comments

hamid commented

Hi. I do the installation step by step in android but in the android studio I 'v got the following error:

Unable to resolve dependency for ':mapbox-react-native-mapbox-gl@debug/compileClasspath': Could not resolve com.squareup.okhttp3:okhttp:3.10.0.
Open File
Show Details


Unable to resolve dependency for ':mapbox-react-native-mapbox-gl@debug/compileClasspath': Could not resolve com.squareup.okio:okio:1.14.0.
Open File
Show Details


Unable to resolve dependency for ':mapbox-react-native-mapbox-gl@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:27.0.2.
...
...
...
  • my react native version: '59'
  • buildToolsVersion = "28.0.3"
  • minSdkVersion = 16
  • compileSdkVersion = 28
  • targetSdkVersion = 28
  • supportLibVersion = "28.0.0"
  • com.android.tools.build = gradle:3.3.1
hamid commented

According to this issue the problem is related to gradle that mapir-react-native-sdk works only in gradle:3.2.1.
to fix change node_modules/mapir-mapbox/android/rctmgl/build.gradle and add the following line to its dependencies

implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'

in fact the rctmgl/build.gradle is :

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // React Native
    compileOnly "com.facebook.react:react-native:+"

    // Mapbox SDK
    implementation 'com.mapbox.mapboxsdk:mapbox-android-services:2.2.9'

    implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:5.5.2@aar') {
        transitive=true
    }



    // Fix issues
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.squareup.okhttp3:okhttp:3.12.1'



    // Mapbox plugins
    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization:0.1.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.3.0'
}

thanks for your attention!
Our sdk is based on mapbox-react-native-mapbox-gl that use react-native<=57 and so on!
Upgrade is in progress!