android - 警告:需要版本2.10。当前版本是2.4

标签 android android-studio gradle android-gradle-plugin

我试图使用GCM实现Android推送通知。以下是我得到的错误

最新错误

  Warning:Gradle version 2.10 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in C:\Users\seng\AndroidStudioProjects\ChatApp\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip

Can't start Git: git.exe
            Probably the path to Git executable is not valid. Fix it. (show balloon)

应用程序级别build.gradle文件
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'

    //This line is added
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
}

//This line is added
apply plugin: 'com.google.gms.google-services'

项目级别build.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:1.3.0'

        //These two lines are added
        classpath 'com.google.gms:google-services:1.5.0-beta2'
        classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
        // 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
}

gradle-wrapper.properties
#Mon Jul 18 23:51:22 SGT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
https\://services.gradle.org/distributions/gradle-2.10-all.zip=

最佳答案

您需要编辑gradle/wrapper/gradle-wrapper.properties

distributionUrl更改为https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

关于android - 警告:需要版本2.10。当前版本是2.4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38440771/

相关文章:

android - 如何在 Ubuntu 上的 LG G4 上调试我的应用程序?

android - 在 Android 中 .0 dp 是什么意思?

android-studio - Android 设备监视器使模拟器离线

java - 如何让Android Studio生成R.java?

gradle - 如何下载非依赖性工件作为语义版本控制的buildScript block 的一部分

android - Google Play 应用发布问题

java - 当键盘出现时使整个布局变小

android - Flutter with Android Studio 不显示设备列表

android - Crashlytics (Fabric) 为应用程序变体(构建类型、产品风格)分离组织

gradle - 如何在构建 gradle 文件中更改 android 应用程序名称