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?