代码之家  ›  专栏  ›  技术社区  ›  Hamzeh Soboh

无法在Android Studio上导入项目

  •  1
  • Hamzeh Soboh  · 技术社区  · 11 年前

    我最近从Eclipse迁移到了AndroidStudio。我面临着一些关于Gradle的问题。

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

    错误:(16,0)找不到Gradle DSL方法:“runProguard()” 可能的原因:

  • 项目“Android Material Example master”可能使用不包含该方法的Gradle版本。 打开Gradle包装文件
  • 生成文件可能缺少Gradle插件。 应用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() 他们在谈论!有什么解决方案吗?

    1 回复  |  直到 10 年前
        1
  •  2
  •   Lennon Spirlandelli    11 年前

    在大楼里试试这个。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.+'
    }