Could not find method compile() for arguments [com.android.support:recyclerview-v7:25.3.1]

hi,

In my android studio build gradle is failed i dont know how so then i check the log and i saw this error Error:Could not find method compile() for arguments [com.android.support:recyclerview-v7:25.3.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Please install the Android Support Repository from the Android SDK Manager. Open Android SDK Manager

then i check it but android support respository is already installed version 47.0.0 i restart android studio but it shows same error how i solve this error from android studio please help me to solve this problem?

Hi @palash,

This could be a side effect of a missing plugin. ā€œcompileā€ is added by the a Java or a Android plugin. Can you check which plugins are applied in your build? (Note: instead of compile, you should use ā€œimplementationā€ or ā€œapiā€)

1 Like

Hi jendrik,
thank you for you reply on your busy time, i see and my doubt on this line below i mention it on project gradle

       compile "com.android.support:recyclerview-v7:25.3.1"
       compile "com.android.support:recyclerview-v7:27.1.1"

what i do now?

Which plugins do you apply in your build?

plugins {
    ..
}

Or

apply plugin: ...
1 Like

on my project>build gradle>
i used apply plugin: on my gradle.

so what do next ???

Which plugins do you apply using apply plugin: .... Can you share that part of your build script? Make sure you apply the plugins in the beginning before the dependencies block. E.g.:

apply plugin: "com.android.application"

...

dependencies {
       compile "com.android.support:recyclerview-v7:27.1.1"
}
1 Like

hi jendrik,
good to see you,no problem to share a code but i am here hesitate to share code so can i share my code on mail or github?

Hi Jendrik,

Hope you are doing well. Iā€™m applying below plugins and my dependencies are below plugins:

apply plugin: ā€˜javaā€™
apply plugin: ā€˜ideaā€™
apply plugin: ā€˜eclipseā€™
apply plugin: ā€˜org.springframework.bootā€™
apply plugin: ā€˜io.spring.dependency-managementā€™

repositories {
mavenCentral()
}

dependencies {
compile ā€˜org.springframework.boot:spring-boot-starter-webā€™,
ā€˜org.springframework.boot:spring-boot-starter-jerseyā€™,
ā€˜org.springframework.boot:spring-boot-starter-jdbcā€™,
ā€˜com.h2database:h2:1.4.+ā€™

compile 'io.swagger:swagger-jersey2-jaxrs:1.5.10'

compile 'javax.xml.bind:jaxb-api',
        'com.sun.xml.bind:jaxb-core:2.3.0.1',
        'com.sun.xml.bind:jaxb-impl:2.3.0.1',
        'javax.activation:activation:1.1.1'

However, Iā€™m still receiving an error here:

  • Where:

Build file ā€˜/Users/ameymuddeshwar/Downloads/VideoGameDB-master/build.gradleā€™ line: 24

  • What went wrong:

A problem occurred evaluating root project ā€˜video-game-databaseā€™.

Could not find method compile() for arguments [org.springframework.boot:spring-boot-starter-web, org.springframework.boot:spring-boot-starter-jersey, org.springframework.boot:spring-boot-starter-jdbc, com.h2database:h2:1.4.+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Bold is line 24 in my build.gradle. Can you please help me with this?

Maybe the issue is that you upgraded to Gradle 7, which deprecated the Java pluginā€™s compile , runtime , testCompile , and testRuntime configurations? You should use implementation , runtimeOnly , testImplementation , and testRuntimeOnly instead, also see this answer on StackOverflow.