Android Studio - 找到不支持的 Gradle DSL 方法: 'getProguard()



我在Mac上运行android Studio 0.6.1上的现有android项目,但我得到这个错误:构建脚本错误,发现不支持的Gradle DSL方法:'getProguard()'!

我已经尝试升级到最新的Android Studio,但有同样的问题,我也尝试了以下问题论坛中描述的所有解决方案:https://code.google.com/p/android/issues/detail?id=72419因为许多其他人似乎有类似的问题,他们已经解决了。也就是说,更新到SDK工具版本23.0.2,并下载最新的adt包。

proguard文件夹实际上也出现在sdk> Tools中,所以它实际上不是proguard缺失的问题。

这是根构建。gradle文件

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.11.+'
    }
}

和构建。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 Desktop上使用相同版本的Android Studio运行项目。所以我不认为这和项目本身有什么关系。

这是因为HockeyApp插件的v1.1与Android Gradle插件的v0.11不兼容。根据HockeyApp (https://github.com/x2on/gradle-hockeyapp-plugin/releases)的发布说明,您应该使用2.1.

相关内容

  • 没有找到相关文章

最新更新