0

I'm trying to use yelp-fusion-android library. I tried updating the gradle but no luck.

I am getting this error:

ERROR: Gradle DSL method not found: 'compile()'
Possible causes:
The project 'testProject' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file

The build file may be missing a Gradle plugin.
Apply Gradle plugin

Here is build.gradle:

buildscript {
repositories {
    google()
    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.5.1'
    classpath 'com.google.gms:google-services:4.3.2'
    compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Jcheong
  • 21
  • 6

4 Answers4

0

Your problem is here compile 'io.github.ranga543:yelp-fusion-client:0.1.4'

Compile is deprecated use "Implementation" instead

and you are placing it in the wrong gradle there are 2 gradle files please note this warning // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files

Ruben Meiring
  • 333
  • 2
  • 21
0

Place below dependency in app module instead of main project gradle.

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

and replace compile with Implementation. e.g (In app module)

Implementation 'io.github.ranga543:yelp-fusion-client:0.1.4'
Hardik Bambhania
  • 1,732
  • 15
  • 25
0

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'
    ...
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
0

dependencies section inside buildscript is not for module dependencies. Hence. move out compile 'io.github.ranga543:yelp-fusion-client:0.1.4' from this section and create top level dependencies block and put it there as below:

buildscript {
repositories {
    google()
    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.5.1'
    classpath 'com.google.gms:google-services:4.3.2'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

dependencies {
    compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
    }

Also, if you have got submodule then you can add this dependency to the sub-module.

Vinay Prajapati
  • 7,199
  • 9
  • 45
  • 86