【问题标题】:Right version of the android google play services安卓谷歌播放服务的正确版本
【发布时间】:2017-08-08 04:45:31
【问题描述】:

我正在构建一个 android 应用程序来将文本文件存储在谷歌驱动器中。根据我的观点,代码是可以的。但是当我放置谷歌播放服务的应用程序级别依赖时,它会在应用程序级别版本依赖中引发错误。由于这个原因,我无法同步 gradle。我认为错误在于版本号。 这是我放的播放服务依赖项 "编译'com.google.android.gms:play-services:8.4.0'"

这是在我放置上述依赖项时显示为错误的依赖项 "编译'com.android.support:appcompat-v7:23.4.0'"

这是我的应用程序级别 graddle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.xxxxx.calllogtogoogledrive"
        minSdkVersion 19
        targetSdkVersion 23
        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:23.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services:8.4.0'
}

这里是项目级别的gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'

        // 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
}

【问题讨论】:

    标签: android


    【解决方案1】:

    您可以尝试像这样更改您的 build.gradle 吗?

    allprojects {
        repositories {
            maven { url "http://jcenter.bintray.com" }
        }
    

    删除jcenter()添加这个。

    【讨论】:

    • 编译错误消失了。现在有一个运行时错误。
    猜你喜欢
    • 2015-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-21
    • 2023-03-14
    • 2018-10-03
    相关资源
    最近更新 更多