我在Mac上运行Android Studio 0.6.1上的现有Android项目,但是收到此错误: 构建脚本错误,发现不支持的Gradle DSL方法:'getProguard()'!
我已尝试升级到最新的Android Studio但问题相同,我也尝试了以下问题论坛中描述的所有解决方案:https://code.google.com/p/android/issues/detail?id=72419因为许多其他人似乎也有类似的问题他们已经解决了。即,更新到SDK工具rev 23.0.2,并下载最新的adt包。
proguard文件夹确实出现在sdk>中工具也是如此,这实际上并不是缺少proguard的问题。
这是root build.gradle文件
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
主模块中的build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:1.1+'
}
}
apply plugin: 'android'
apply plugin: 'hockeyApp'
configurations {
apt
}
dependencies {
compile 'com.android.support:support-v4:19.0.+'
FileTree tree = fileTree(dir: 'libs', include: '*.jar');
tree.exclude 'android-support-v4.jar'
compile tree;
apt fileTree(dir: 'compile-libs', include: '*.jar')
compile project(':thirdparty:google-play-services_lib')
compile project(':thirdparty:DaoCore')
compile project(':thirdparty:SlidingMenu-master:library')
compile project(':thirdparty:jump.android:Jump')
compile project(':thirdparty:drag-sort-listview')
compile project(':thirdparty:AndroidHorizontalListView')
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src-gen','src','.apt_generated']
resources.srcDirs = ['src-gen','src','.apt_generated']
aidl.srcDirs = ['src-gen','src','.apt_generated']
renderscript.srcDirs = ['src-gen','src','.apt_generated']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
signingConfigs {
releaseSigning {
storeFile file('***')
storePassword ***
keyAlias ***
keyPassword ***
}
}
buildTypes {
release {
signingConfig signingConfigs.releaseSigning
}
}
hockeyapp {
apiToken = "***"
releaseType = 0
notify = 0
status = 2
notesType = 1
notes = "This is an automatic upload"
symbolsDirectory = file("build/symbols/")
mappingFileNameRegex = "R.txt"
}
}
android.applicationVariants.all { variant ->
ext.aptOutput = file(".apt_generated")
ext.aptOutput.deleteDir()
ext.aptOutput.mkdirs()
variant.javaCompile.options.compilerArgs += [
'-processorpath', configurations.apt.asPath,
'-AandroidManifestFile=' + variant.processResources.manifestFile,
'-s', ext.aptOutput
]
}
// clean generated files
task clean(overwrite:true) {
delete fileTree(dir: ".apt_generated")
}
此处的另一位开发人员已经能够在他的Windows 8桌面上使用相同版本的Android Studio& amp; Gradle所以我认为这可能与项目本身无关。
答案 0 :(得分:0)
这是因为HockeyApp插件的v1.1与Android Gradle插件的v0.11不兼容。根据HockeyApp(https://github.com/x2on/gradle-hockeyapp-plugin/releases)的发行说明,你应该使用2.1。