-1

I tried almost everything. Nothing helps. When I'm adding this lib compile 'com.github.bassaer:chatmessageview:1.10.0', it gives error like this Error:Failed to resolve: com.android.support:support-v4:26.1.0.

Here my gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "24.0.3"
    defaultConfig {
        applicationId "com.supportop"
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    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:recyclerview-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile('io.github.sac:SocketclusterClientJava:1.7.4') {
        exclude group: 'org.json', module: 'json'
    }
    compile 'com.github.bassaer:chatmessageview:1.10.0'
    testCompile 'junit:junit:4.12'
}

As you see I'm using version 25.3.1 , so when I'm removing the lib compile 'com.github.bassaer:chatmessageview:1.10.0', the problem disappears. What can I do here? Invalidate catches, rebuild project and clean project not helps.

Here the image

Hayk Mkrtchyan
  • 2,835
  • 3
  • 19
  • 61

3 Answers3

0

As google suggest it is best to upgrade to the newer version of android using the latest version of BuildTools, CompileSDK and supportLibraries.

However if you really have to work with this particular version of support libraries you can remove the transitive dependency that chatmessageview have like this:

compile ('com.github.bassaer:chatmessageview:1.10.0'){
    exclude group: 'com.android.support', module:'appcompat-v7'
}

But remember that this library may had a good reason to use a newer version of supportLibs. Cheers!

Keivan Esbati
  • 3,376
  • 1
  • 22
  • 36
0

I hope this will work for you

Add this in project gradle file support library requires google() as a mevan

allprojects {
repositories {
    google()
    jcenter()
   }
}
GParekar
  • 1,209
  • 1
  • 8
  • 15
0

It's Because the com.github.bassaer:chatmessageview:1.10.0 library using the buildToolsVersion "26.0.2" and while you add it to your dependencies it will go to find the given buildToolsVersion synchronization and if it doesn't found it will throw you Failed to resolve 26.1.0 because the library configured on this version.

So either you need to go to library build.gradle file and downgrade it's buildToolsVersion and dependencies same as yours. Or you need to upgrade your SDK if not for that just click on Install repository and sync project. It will download the required components and you may be able to sync your projects then after.

But i suggest to not downgrading the buildToolsVersion of library instead install require components. Because library may dependent new features on latest version.

Jay Rathod
  • 11,131
  • 6
  • 34
  • 58