无法解决此错误,我已更新Android工作室.走了其他this解决方案,但没有为我工作,请帮助..
构建脚本错误,发现不支持的Gradle DSL方法:’release()’!
可能的原因可能是:
– 您正在使用没有方法的Gradle版本
– 您没有应用提供该方法的Gradle插件
– 或者构建脚本中存在错误
Gradle设置
Gradle版本 – 0.9
主要的gradle.
// top-level build file where you can add configuration options common to all sub-projects/modules.buildscript { repositorIEs { mavenCentral() } dependencIEs { classpath 'com.androID.tools.build:gradle:0.9.+' }}apply plugin: 'androID'androID { compileSdkVersion 19 buildToolsversion "19.0.0"}
Project Gradle文件
apply plugin: 'androID'repositorIEs { mavenCentral()}androID { compileSdkVersion 17 buildToolsversion '18.0.1' defaultConfig { minSdkVersion 8 targetSdkVersion 17 } signingConfigs { release { storefile file('dsc.jks') storePassword 'dscneo' keyAlias 'dsc' keyPassword 'dscneo' } } buildTypes { deBUG { versionnameSuffix '-DEBUG' } beta { versionnameSuffix '-BETA' } release { signingConfig signingConfigs.release } }}dependencIEs { compile 'com.Google.androID.gms:play-services:3.1.36' compile 'com.androID.support:appcompat-v7:18.0.+' compile 'com.androID.support:support-v4:+' compile files('libs/libGoogleAnalytiCSServices.jar') compile files('libs/signpost-commonshttp4-1.2.1.1.jar') compile files('libs/signpost-core-1.2.1.1.jar') compile files('libs/gson-2.1.jar') compile project(':facebook') compile project(':TabIndicatorlibrary') compile files('libs/YouTubeAndroidplayerAPI.jar') compile project(':VerticalVIEwPager') compile files('libs/universal-image-loader-1.9.1.jar') compile files('libs/universal-image-loader-1.9.1-sources.jar') compile files('libs/twitter4j-core-3.0.5.jar') compile files('libs/HockeySDK-3.0.1.jar')}
Facebook SDK gradle文件
apply plugin: 'android-library'dependencIEs { compile 'com.androID.support:support-v4:18.0.0'}androID { compileSdkVersion 17 buildToolsversion "18.0.1" sourceSets { main { manifest.srcfile 'AndroIDManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aIDl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/deBUG/java, build-types/deBUG/AndroIDManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanIEd // by a similar customization. deBUG.setRoot('build-types/deBUG') release.setRoot('build-types/release') }}
其他库项目gradle文件
buildscript { repositorIEs { mavenCentral() } dependencIEs { classpath 'com.androID.tools.build:gradle:0.9.+' }}apply plugin: 'android-library'dependencIEs { compile 'com.androID.support:support-v4:18.0.0'}androID { compileSdkVersion 16 buildToolsversion '18.0.1' sourceSets { main { manifest.srcfile 'AndroIDManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aIDl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/deBUG/java, build-types/deBUG/AndroIDManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanIEd // by a similar customization. deBUG.setRoot('build-types/deBUG') release.setRoot('build-types/release') }}
还有一个库项目gradle文件.
apply plugin: 'android-library'repositorIEs { mavenCentral()}androID { compileSdkVersion 18 buildToolsversion "19.0.0" defaultConfig { minSdkVersion 7 targetSdkVersion 16 versionCode 1 versionname "1.0" } release { runProguard false proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.txt' }}dependencIEs { compile 'com.androID.support:appcompat-v7:+'}
解决方法:
在您的上一个文件(库)中,您在androID块中有释放块.
现在,库项目的DSL与应用程序项目的DSL相同
在特殊情况下,您必须将release块放在buildTypes中.
androID { buildTypes { release { } }
另外,我建议您使用buildToolsversion ’19 .0.x’作为所有gradle文件.
您可以将它放在根文件夹中的build.gradle中.
ext { compileSdkVersion = 19 buildToolsversion = "19.0.3"}
然后在每个build.gradle文件中,您可以使用:
compileSdkVersion rootProject.ext.compileSdkVersion buildToolsversion rootProject.ext.buildToolsversion
总结 以上是内存溢出为你收集整理的android – 构建脚本错误,发现不支持的Gradle DSL方法:’release()’!当uograded到0.5.1全部内容,希望文章能够帮你解决android – 构建脚本错误,发现不支持的Gradle DSL方法:’release()’!当uograded到0.5.1所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)