我最近从Eclipse迁移到Android Studio。我正面临一些关于Gradle的问题。
我尝试从github导入此项目:https://github.com/saulmm/Android-Material-Example,但收到此错误消息:
错误:(16,0)未找到Gradle DSL方法:' runProguard()' 可能的原因:
项目' Android-Material-Example-master'可能正在使用不包含该方法的Gradle版本。 打开Gradle包装器文件 构建文件可能缺少Gradle插件。 申请Gradle插件
这是我的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()
!任何解决方案?
答案 0 :(得分:2)
在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.+'
}