android studio-Gradle的问题

android studio-Gradle的问题,android,gradle,android-studio,Android,Gradle,Android Studio,我在android应用程序中进行代码维护,其他人在android studio中编写 当我尝试将项目与Gradle文件同步时,会收到以下错误消息: 23:46:27 UnsupportedMethodException Failed to set up Android modules in project 'BuyTheWay': Unsupported method: SourceProvider.getJniDirectories(). The version of Gr

我在android应用程序中进行代码维护,其他人在android studio中编写

当我尝试将项目与Gradle文件同步时,会收到以下错误消息:

23:46:27 UnsupportedMethodException
     Failed to set up Android modules in project 'BuyTheWay': Unsupported method: SourceProvider.getJniDirectories().
     The version of Gradle you connect to does not support that method.
     To resolve the problem you can change/upgrade the target version of Gradle you connect to.
     Alternatively, you can ignore this exception and read other information from the model.
    Error:(17, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:
     The project 'BuyTheWay' may be using a version of Gradle that does not contain the method.
    <a href="open.wrapper.file">Open Gradle wrapper file</a>
    The build file may be missing a Gradle plugin.
    <a href="apply.gradle.plugin">Apply Gradle plugin</a>
我使用的是android studio的0.8.14版本

在回答类似问题时,建议在build.gradle文件(在应用程序文件夹中)中替换以下行:

runProguard false

但它对我没有帮助,因为编译器还在行中标记“getDefaultProguardFile”

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
并主张:

cannot resolve symbol getDefaultProguardFile
尝试不同的方法,并更改gragle文件夹中的build.grale,dint help

这是原始代码:

// 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:0.14.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
当我改变

classpath 'com.android.tools.build:gradle:0.14.0'  

并尝试将项目与Gradle文件同步,我收到以下错误消息:

23:46:27 UnsupportedMethodException
     Failed to set up Android modules in project 'BuyTheWay': Unsupported method: SourceProvider.getJniDirectories().
     The version of Gradle you connect to does not support that method.
     To resolve the problem you can change/upgrade the target version of Gradle you connect to.
     Alternatively, you can ignore this exception and read other information from the model.
    Error:(17, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:
     The project 'BuyTheWay' may be using a version of Gradle that does not contain the method.
    <a href="open.wrapper.file">Open Gradle wrapper file</a>
    The build file may be missing a Gradle plugin.
    <a href="apply.gradle.plugin">Apply Gradle plugin</a>
错误:(17,0)找不到Gradle DSL方法:“runProguard()”
可能的原因:
“BuyTheWay”项目可能使用的Gradle版本不包含该方法。
生成文件可能缺少Gradle插件。

一步就能解决这个问题

buildTypes {
  release {
    apply plugin: 'eclipse'
    runProguard false // <==== **remove this line**
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  }
}
构建类型{
释放{
应用插件:“eclipse”

runProguard false//对于Android Studio,它是这样的..应用插件:'idea'。谢谢