Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve: livedata-core

I am just trying to open an existing project in android studio 3.1.4 . after resolving all the errors I can't come up with this new one that says:

Failed to resolve: livedata-core

Open File

Failed to resolve: livedata-core

Open File

It refers to two of project's files (build.gradle)s one is this:

//noinspection GradleDependency
apply plugin: 'com.android.application'


buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
        google()
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
    google()
}

android {
    compileSdkVersion 28
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "come.texi.driver"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 2
        versionName "2.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "4g"
    }

}

dependencies {
    def lifecycle_version = "1.1.1"

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //    compile 'com.jakewharton:butterknife:7.0.1'
    //compile 'com.loopj.android:android-async-http:1.4.9'
    implementation project(':facebooklibrary')
    implementation project(':slideMenuLibrary')
    implementation project(':stripe')
    implementation('com.twitter.sdk.android:twitter:1.13.0@aar') {
        transitive = true
    }
    //compile 'com.github.nkzawa:socket.io-client:0.3.0'
    implementation('io.socket:socket.io-client:0.7.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }
    //compile 'com.paypal.sdk:paypal-android-sdk:2.14.4'
    implementation('com.paypal.sdk:paypal-android-sdk:2.14.4') {
        exclude group: 'org.json', module: 'json'
    }

    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:23.4.0'
    //noinspection GradleCompatible
    implementation 'com.android.support:design:23.4.0'
    implementation 'cz.msebera.android:httpclient:4.4.1.1'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.koushikdutta.ion:ion:2.2.1'
    implementation 'com.victor:lib:1.0.1'
    implementation 'com.facebook.android:facebook-android-sdk:4.7.0'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-analytics:16.0.3'
    implementation 'com.google.android.gms:play-services-gcm:15.0.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
}

and another one is this:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
    }
}
apply plugin: 'com.android.library'

dependencies {
    implementation 'com.android.support:support-v4:27.1.1'
}

android {
    compileSdkVersion 28
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 28
    }

    sourceSets {
        main {
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']

            manifest.srcFile 'AndroidManifest.xml'
        }
    }

}

I am wondering where is the problem?

like image 259
MohammadReza Hosseini Avatar asked Dec 18 '22 21:12

MohammadReza Hosseini


1 Answers

allprojects {
    repositories {
        google()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
        jcenter()

    }
}

You must place google() as the 1st line in both projects and do not need to modify other lines, just add google() at the beginning.

like image 156
Anubhav Gupta Avatar answered Dec 30 '22 12:12

Anubhav Gupta