问题的依赖。 Android Studio中集成MapBox [英] Problems with dependencies. Integrating MapBox in Android Studio

查看:1182
本文介绍了问题的依赖。 Android Studio中集成MapBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题与整合MapBox SDK到我的项目。

I have some problems with integration MapBox SDK into my project.

下面是介绍如何添加依赖到摇篮:
https://www.mapbox.com/mapbox-android-sdk/#gradle

Here is description how to add dependency into Gradle: https://www.mapbox.com/mapbox-android-sdk/#gradle

所以,我要补充到我的build.gradle这样的:

So, I should add this into my build.gradle:

repositories {
    mavenCentral()
}

dependencies {
    compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4@aar'){
        transitive=true
    }
}

在我的build.gradle如下:

After that my build.gradle looks like:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.samusko.journeyproject"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.android.support:cardview-v7:22.1.1'

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

当我编译这个我有这个错误:

When I compile this I have this error:

Error:Failed to resolve: com.android.support:support-v4:22.2.0

我不知道什么是错:(。
请帮我解决这个错误。

I don't know what is wrong :(. Please help me to resolve this error..

推荐答案

您丢失的文件的gradle这一行,把它之前的com.mapboxsdk:...行(您使用支持库太老了):

You are missing this line in the gradle file, put it before the "com.mapboxsdk:..." line (the support libraries you used were too old):

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

    ##### begin fix   
    # modified 2.1.1 to 2.2.0
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:cardview-v7:22.2.0'
    ##### end fix   

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

请注意,此版本MapBox的不再支持的上行。他们去precated它,即使艰难(恕我直言)当我写这条消息的新的API是不够用。

Note that this version of MapBox is no longer supported upstream. They deprecated it, even tough (IMHO) as I am writing this message the new API is not usable enough.

这篇关于问题的依赖。 Android Studio中集成MapBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆