无法在 Android Studio 上导入项目

Can't import a project on Android Studio

我最近从 Eclipse 迁移到了 Android Studio。我遇到了一些关于 Gradle.

的问题

我试图从 github 导入此项目:https://github.com/saulmm/Android-Material-Example,但收到此错误消息:

Error:(16, 0) Gradle DSL method not found: 'runProguard()' Possible causes:

  • The project 'Android-Material-Example-master' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • 这是我的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.0.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        } }
    
    allprojects {
        repositories {
            jcenter()
        } }
    

    这是我的 gradle-wrapper.properties

    #Wed Apr 10 15:27:10 PDT 2013 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
    

    我找不到 runProguard() 他们在说什么!有什么解决办法吗?

    在 build.gradle 中试试这个:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 20
        buildToolsVersion "20.0.0"
    
        defaultConfig {
            applicationId "package"
            minSdkVersion 14
            targetSdkVersion 20
            versionCode 1
            versionName "1.0.0"
        }
    
        buildTypes {
            release {
    
            /**
            *
            * Here is the change that must be done
            *
            **/
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    
    }
    
    buildscript {
    
    }
    
    repositories {
    
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:support-v13:19.+'
    }