mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

problem add dependency project Androidx #13677

Closed FarshidRoohi closed 5 years ago

FarshidRoohi commented 5 years ago

i'm use :

add dependency : 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.8.1'

and show error :

Failed to resolve: fragment
Open File

Failed to resolve: core
Open File

Does it not support Android or is the problem from somewhere else? thanks

tobrun commented 5 years ago

@FarshidRoohi are you enabling jetifier so your build process converts support libs to androidx? More information in https://developer.android.com/jetpack/androidx/.

FarshidRoohi commented 5 years ago

@tobrun I'm familiar with Androidx The problem is that I only add this library

i'm test another project migrate androidx and add map-box sdk and worked but not add dependency my project asked question this

tobrun commented 5 years ago

@FarshidRoohi

I did a quick test by creating an new Android Studio project with an empty activity template. Afterwards migrated to AndroidX using the Android Studio menu option and added Maps SDK gradle line with the java 8 configuration.

I'm able to compile this without an build error, this is my build.gradle:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.tobrun.testapplication"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.8.1'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
FarshidRoohi commented 5 years ago

I've added the following dependencies and my problem has been resolved 👍

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
kapt 'androidx.databinding:databinding-compiler:3.3.0'

I do not know if this was a problem, or something that I did not understand was resolved.

tobrun commented 5 years ago

@FarshidRoohi that config definitely makes sense. Thank you for reporting this back to us!