map-ir / mapir-react-native-sdk

MIT License
14 stars 3 forks source link

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

Closed hamid closed 5 years ago

hamid commented 5 years ago

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.
...
...
...
hamid commented 5 years ago

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'
}
ReyhaneMasumi commented 5 years ago

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!