palash
palash

Reputation: 31

How to solve could not find method compile() for arguments com.android.support:recyclerview-v7:25.3.1?

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? I think something is wrong on my build gradle but i cant get it where is wrong or what happens here is my build gradle sample-------

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
maven {
url "https://github.com/Blox/blox-android-sdk-releases/raw/master/"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:2.3.0'

    ext {
        compileSdkVersion = 23
        buildToolsVersion = "23.0.2"

        minSdkVersion = 14
        targetSdkVersion = 23

        sourceCompatibility = JavaVersion.VERSION_1_7
        targetCompatibility = JavaVersion.VERSION_1_7

        lintAbortOnError = false

        // Blox SDK version
        ext.qbSdkVersion = '3.3.1'

        ext.versionName = '3.3.0'

        ext.testRunnerVersion = "0.4.1"


        // Dependency versions
        playServicesVersion = '10.2.1'
        supportV4Version = '23.1.1'
        appcompatV7Version = '23.1.1'
        recyclerviewV7Version = '23.2.1'
        supportAnnotationsVersion = '23.1.1'
        designVersion = '23.1.1'

        uilVersion = '1.9.0'
        glideVersion = '3.6.1'
        pullToRefreshVersion = '3.2.3'
        stickyListHeaders = '2.7.0'
        robotoTextViewVersion = '2.4.3'
        stickersVersion = '0.7.3'
        crashlyticsVersion = '2.2.2'
    }


    compile "com.android.support:recyclerview-v7:25.3.1"
    compile "com.android.support:recyclerview-v7:27.1.1"
    compile "com.android.support:cardview-v7:23.+"
    compile "com.android.support:support-annotations:${rootProject.supportAnnotationsVersion}"

    compile "com.navercorp.pulltorefresh:library:${rootProject.pullToRefreshVersion}@aar"
    compile("com.crashlytics.sdk.android:crashlytics:${rootProject.crashlyticsVersion}@aar") {
        transitive = true;
    }
    compile 'com.github.bumptech.glide:glide:3.6.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
// Blox SDK version
qbSdkVersion = '3.3.1'

versionName = '3.4.1'

testRunnerVersion = "0.4.1"

allprojects {
    repositories {
        maven { url 'http://maven.pipe.com/artifactory/factory' }
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

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

Android \ build gradle

`apply plugin: 'com.android.application'

android {
// signingConfigs {
// config {
// keyAlias 'abc'
// keyPassword 'abc'
// storeFile file(D:\Users\Lake\Desktop\myap_keystore\myap.jks)
// storePassword 'abc'
// }
// defaultConfig {
// applicationId "abcd.com.myap"
// minSdkVersion 19
// targetSdkVersion 23
// versionCode 1
// versionName "1.0"
// }
// }
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "abc.com.myap"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
// signingConfig signingConfigs.config
resValue "string", "versionName", "Blox WebRTC\nBuild version " + defaultConfig.getVersionName()
signingConfig signingConfigs.debug
}
}
// debug {
resValue "string", "versionName", "Blox WebRTC\nBuild version " + defaultConfig.getVersionName()
signingConfig signingConfigs.debug
}
// signingConfig signingConfigs.config
// debuggable true
// }
}
}
def pipeSdkVersion = '0.15.1'
dependencies {
compile "com.blox-android-sdk-videochat-webrtc:$rootProject.qbSdkVersion"

compile(project(":sample-core"))
// online dependencies, from remote repository, aar files

compile fileTree(include: ['*.jar'], dir: 'libs')
dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.android.support:design:25.3.1'
compile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.android.support:gridlayout-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.github.apl-devs:intro:v4.2.2'
compile("vc908.stickers:sfactory:$pipeSdkVersion") {
    transitive = true;
}
compile("vc908.stickers:gcmintegration:$pipeSdkVersion") {
    transitive = true;
}
compile("vc908.stickers:jpushintegration:$pipeSdkVersion") {
    transitive = true;
}
compile files('libs/StartAppInApp-3.6.3.jar')
compile 'com.blox:blox-android-sdk-core:2.5.1'
compile('com.blox:blox-android-sdk-chat:2.5.1@aar') {
    transitive = true
}
compile "com.blox:blox-android-sdk-chat:$rootProject.qbSdkVersion"
compile "com.blox:quickblox-android-sdk-content:$rootProject.qbSdkVersion"
compile "com.blox:quickblox-android-sdk-customobjects:$rootProject.qbSdkVersion"
compile "com.blox:quickblox-android-sdk-location:$rootProject.qbSdkVersion"
compile ("com.blox:blox-android-sdk-messages:$rootProject.qbSdkVersion" )
compile "com.github.johnkil.android-robototextview:robototextview:${rootProject.robotoTextViewVersion}"

apply plugin: 'com.google.gms.google-services'
}
`

[NOTE:I am using javascript snippets here for showing code properly]

Upvotes: 1

Views: 11861

Answers (3)

i changed dependencies with the code:

dependencies {

implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

Worked for me

Upvotes: 0

angel_30
angel_30

Reputation: 1

Replace compile with implementation and you should be good.

(compile was recently deprecated and replaced by implementation or api)

Upvotes: 5

Haider Saleem
Haider Saleem

Reputation: 773

You are adding these dependencies to build.gradle(Project)

compile "com.android.support:recyclerview-v7:25.3.1"
    compile "com.android.support:recyclerview-v7:27.1.1"
    compile "com.android.support:cardview-v7:23.+"
    compile "com.android.support:support-annotations:${rootProject.supportAnnotationsVersion}"

    compile "com.navercorp.pulltorefresh:library:${rootProject.pullToRefreshVersion}@aar"
    compile("com.crashlytics.sdk.android:crashlytics:${rootProject.crashlyticsVersion}@aar") {
        transitive = true;
    }
    compile 'com.github.bumptech.glide:glide:3.6.1' 

Instead put dependencies in build.gradle(Module:app) and replace compile with implementation as 'compile' is obsolete and has been replaced with 'implementation'

Upvotes: 0

Related Questions