无法添加依赖项mapBox SDK错误片段

时间:2019-01-07 12:37:04

标签: android kotlin mapbox androidx

问题添加mapBoxSDK android

渐变类路径:

 classpath 'com.android.tools.build:gradle:3.2.1'

和库:

  implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
  implementation 'com.google.android.material:material:1.1.0-alpha02'

  implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.8.1'

对此错误:

Failed to resolve: fragment
Open File


Failed to resolve: core
Open File

更新

渐变应用文件:

使用 androidx java 1.8 gradle 2.3.1

我猜我不支持Androidx? 你觉得这有问题吗?     应用插件:“ com.android.application”     应用插件:“ kotlin-android”     应用插件:“ kotlin-kapt”     应用插件:“ kotlin-android-extensions”     应用插件:“ com.google.gms.google-services”     应用插件:“ io.fabric”

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "xxxx"
        minSdkVersion 17
        targetSdkVersion 28
       ....
    }
   ...
    dataBinding {
        enabled = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    def lifecycle_version = "2.1.0-alpha01"
    def room_version = "2.0.0-rc01"
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha01'
    implementation 'com.google.android.material:material:1.1.0-alpha02'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'

    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    // lifecycle
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    kapt "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
    implementation 'org.osmdroid:osmdroid-android:6.0.3'

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.8.1'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.26.0'


}

3 个答案:

答案 0 :(得分:0)

似乎您正在将依赖项添加到项目级别的gradle文件中。类路径地址应该放在项目级别的buid.gradle文件中,而库依赖项应该放在应用程序级别的build.gradle文件中。

在应用级别build.gradle中,您应该添加:

dependencies {
...
   implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
   implementation 'com.google.android.material:material:1.1.0-alpha02'
   implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.8.1'
}

在项目级别中,您应该添加:

dependencies {
...
  classpath 'com.android.tools.build:gradle:3.2.1'
 }

答案 1 :(得分:0)

您需要在Project-> build.gradle文件中添加

allprojects {
    repositories {
        ...
        maven { url 'https://mapbox.bintray.com/mapbox' }
    }
}

答案 2 :(得分:0)

我添加了以下依赖项,并且我的问题已解决

删除

 <tbody ng-init="getall()">
     <tr ng-repeat="d in names | filter:search">
    <td>{{ d.movieid }}</td>
    <td>{{ d.moviename }}</td>
    <td>{{ d.director }}</td>
    <td>{{ d.cast1 }}</td>
    <td>{{ d.genre }}</td>
    <td><a href="#" ng-click="edituser(d.movieid)">Edit</a> | <a href="" ng-click="deleteuser(d.movieid)">Delete</a></td>
  </tr>
    </tbody>
</table>

添加此:

 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"