如何编译播放服务:11.2.0

时间:2017-09-27 04:24:20

标签: android google-maps android-gradle google-play-services android-support-library

我想获取设备的当前位置,并点击此链接:google 本教程需要Google Play服务版本11.2.0或更高版本。 但是当我编译' com.google.android.gms:play-services:11.2.0'时,我得到:

Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.0

这是我的build.gradle(模块:app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.administrator.googlemap"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.google.android.gms:play-services:11.2.0'
    compile 'com.google.android.gms:play-services-maps:11.0.2'
    compile 'com.google.android.gms:play-services-places:11.0.2'
    compile 'com.google.android.gms:play-services-location:11.0.2'
    testCompile 'junit:junit:4.12'
}

这是我的build.grandle(项目)

buildscript {
    repositories {
        jcenter()
        maven { url "https://maven.google.com/"}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

如何解决此错误。?

2 个答案:

答案 0 :(得分:4)

而不是变量版本名称

 myfunc <- function(data, outcome){



   fit <- tidy(glm(rlang::expr(!! rlang::enexpr(outcome) ~ group), data=data, 
            family = binomial(link = "logit")), 
            exponentiate = TRUE, conf.int=TRUE)

 fit
}

myfunc(df, died)
#         term  estimate std.error  statistic    p.value  conf.low conf.high
#1  (Intercept) 0.8715084 0.1095300 -1.2556359 0.20924801 0.7026185  1.079852
#2 groupGroup 2 0.9253515 0.1550473 -0.5003736 0.61681204 0.6826512  1.253959
#3 groupGroup 3 1.3692735 0.1557241  2.0181864 0.04357185 1.0095739  1.859403

使用常量版本,最新版本为compile 'com.android.support:appcompat-v7:26.+'

26.1.0

你在buildcript存储库列表中有google maven repo链接,你还应该在你的根compile 'com.android.support:appcompat-v7:26.1.0' 文件的项目依赖存储库列表中添加google maven repo

build.gradle

选择性编译是更好的选择,而不是完整的allprojects { repositories { jcenter() maven { url "https://maven.google.com/"} } } 工件,您应该选择项目中需要的内容。

play-services

将其分解为您需要的工件,例如

compile 'com.google.android.gms:play-services:11.2.0'  // -> latest is 11.4.0

如果您使用的是Gradle 3.0.0或更高版本的Android插件

compile 'com.google.android.gms:play-services-maps:11.4.0'
compile 'com.google.android.gms:play-services-places:11.4.0'
compile 'com.google.android.gms:play-services-location:11.4.0'

repositories { mavenLocal() mavenCentral() google() //---> Add this } 替换为compile,有关此替换的更多信息here

答案 1 :(得分:0)

添加

maven {
        url 'https://maven.google.com'
    }
你的build.gradle中的

,即

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
    }
}

如果您使用Play服务11.2.0

,还会删除其他Google依赖项
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-places:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'

compile 'com.google.android.gms:play-services:11.2.0'