java - Gradle failed: unsupported Gradle DSL method found: 'exclude()' -
i'm trying include android project (android studio - latest, gradle) classes google endpoints (python) coded. server side tested , working.
i'm not used gradle, therefore i'm following documentation @ google developers. after changing build.gradle file under src (as instructed doc) to:
build.gradle:
buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' repositories { maven { url 'http://google-api-client-libraries.appspot.com/mavenrepo' } mavencentral() mavenlocal() } android { compilesdkversion 19 buildtoolsversion "19.0.2" defaultconfig { minsdkversion 17 targetsdkversion 19 versioncode 1 versionname "1.0" } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-v4:+' compile 'com.google.android.gms:play-services:4.+' compile('com.google.api-client:google-api-client:1.17.0-rc') { // exclude artifacts android sdk/runtime provides. exclude('xpp3:xpp3') exclude('org.apache.httpcomponents:httpclient') exclude('junit:junit') exclude('com.google.android:android') } compile('com.google.api-client:google-api-client-android:1.17.0-rc') { // exclude play services, since we're not using yet. exclude('com.google.android.google-play-services:google-play-services') } compile('com.google.http-client:google-http-client-android:1.17.0-rc') { exclude('com.google.android:android') } // used google http client library. compile('com.google.guava:guava:14.0.+') }
android studio returns following error:
gradle 'project' project refresh failed: build script error, unsupported gradle dsl method found: 'exclude()'! possible causes be: - using gradle version method absent - didn't apply gradle plugin provides method - or there mistake in build script build file '/project/android/build.gradle' line: 44 : gradle settings
it doesn't how you've set exclude
statements dependencies. if follow example in guide more closely, should work.
for example, instead of:
compile('com.google.api-client:google-api-client:1.17.0-rc') { // exclude artifacts android sdk/runtime provides. exclude('xpp3:xpp3') exclude('org.apache.httpcomponents:httpclient') exclude('junit:junit') exclude('com.google.android:android') }
use this:
compile('com.google.api-client:google-api-client:1.17.0-rc') { // exclude artifacts android sdk/runtime provides. exclude(group: 'xpp3', module: 'xpp3') exclude(group: 'org.apache.httpcomponents', module: 'httpclient') exclude(group: 'junit', module: 'junit') exclude(group: 'com.google.android', module: 'android') }
it's fine use condensed format in initial compile
coordinates.
Comments
Post a Comment