繁体   English   中英

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

[英]Warning:Gradle version 2.10 is required. Current version is 2.4

我试图使用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

  1. 将gradle-wrapper.properties中的distributionUrl更新为

https\\://services.gradle.org/distributions/gradle-2.10-all.zip

  1. 您也可以将根目录build.gradle以及应用程序级别的build.gradle文件中的gradle构建工具更新为最新版本。 在我的情况下,它是classpath 'com.android.tools.build:gradle:2.1.2'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM