Getting Error "Gradle Dsl Method Not Found: 'Compile()'" When Syncing Build.Gradle

Error: Gradle DSL method not found: compile()

Move this line in different lines:

    //TV & Radio
compile "com.android.support:cardview-v7:$supportlib_version" compile "com.android.support:appcompat-v7:$supportlib_version" compile "com.android.support:recyclerview-v7:$supportlib_version" compile "com.android.support:design:$supportlib_version" compile "com.android.support:support-v4:$supportlib_version" compile "com.android.support:support-core-utils:$supportlib_version" compile "com.android.support:support-media-compat:$supportlib_version" compile "com.google.android.gms:play-services-gcm:$gps_version" compile "com.google.android.gms:play-services-ads:$gps_version" compile "com.google.android.gms:play-services-maps:$gps_version" compile 'com.google.maps.android:android-maps-utils:0.5+'

You can't use compile in this way.
Use this:

compile "com.android.support:cardview-v7:$supportlib_version" 
compile "com.android.support:appcompat-v7:$supportlib_version"
compile "com.android.support:recyclerview-v7:$supportlib_version"
compile "com.android.support:design:$supportlib_version"
compile "com.android.support:support-v4:$supportlib_version"
compile "com.android.support:support-core-utils:$supportlib_version"
compile "com.android.support:support-media-compat:$supportlib_version"
compile "com.google.android.gms:play-services-gcm:$gps_version"
compile "com.google.android.gms:play-services-ads:$gps_version"
compile "com.google.android.gms:play-services-maps:$gps_version"
compile 'com.google.maps.android:android-maps-utils:0.5+'

ERROR: Gradle DSL method not found: 'compile()'

Remove this line from the top-level file:

//compile 'io.github.ranga543:yelp-fusion-client:0.1.4'

In the app/build.gradle file you can add the same dependency:

dependencies {
...
implementation 'io.github.ranga543:yelp-fusion-client:0.1.5'
...
}

Getting Error Gradle DSL method not found: 'compile()' when Syncing Build.Gradle

In almost all cases, your dependencies should be put into the individual module's build.gradle files rather than at the top most level build.gradle file. In your case, that means the dependency should be added to the app module's build.gradle file:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:support-v4:18.0.+"
}

And you should remove the entire allprojects part of the top level build.gradle.

How to fix an error Gradle DSL method not found: 'compile()'?

Go to Build.gradle(Module:App) :

image

dependencies {
implementation 'com.android.billingclient:billing:1.0'
}

gradle dsl method not found 'compile()' Error:(10,0)

so according to the documentations i add theses lines into the build.gradle of my project

Please note the comments in that file:

    // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

I do not know what "documentations" that you read that told you to put these things in the project-level build.gradle file. Please consider providing links, so that we can get that material fixed.

To get past this problem, remove the changes that you made to this file. Then, add those dependencies to the module's build.gradle file (e.g., app/build.gradle in a typical Android Studio project).

Gradle DSL method not found: 'compile()'

As the note of your project's build.gradle file suggests:

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

Remove the 2 compile statements in that gradle file:

compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:6.5.+'

And then make your other (module's) build.gradle dependencies look like this:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.+'
}

Gradle DSL method not found: 'compile() The project 'android' may be using a version of Gradle that does not contain the method

The problem is inside the dependencies closure: You can't write multiple compile statements in one line. Just write each compile statement in a separate line, than it will work.

I think it's a bug with auto-formatting when you use variables for the dependency versions and therefore wrap the dependencies in double quotes instead of single quotes.

Android gradle build Error:(65, 0) Gradle DSL method not found: 'compile()'

Could not find method compile() for arguments [org.androidannotations:androidannotations-api:4.2.0] on

Move in two different lines this:

//Annotation
apt "org.androidannotations:androidannotations:$AAVersion" compile "org.androidannotations:androidannotations-api:$AAVersion"

Use

//Annotation
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"

Gradle DSL method not found: 'implementation()'

To use the DSL implementation() you have to use:

  • The updated gradle plugin for Android 3.0.0
  • The gradle version 3.4 or later

Then in your build.gradle you have to use:

buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta1'
}
}

In your gradle-wrapper.properties

distributionUrl=\
https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip

More detailed info here.



Related Topics



Leave a reply



Submit