无法解决:livingata-core

问题描述 投票:3回答:1

我只是想在android studio 3.1.4中打开一个现有的项目。在解决了所有错误后,我无法想出这个新的错误:

无法解决:livingata-core

打开文件

无法解决:livingata-core

打开文件

它指的是项目的两个文件(build.gradle),其中一个是:

//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'
}

另一个是这个:

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'
        }
    }

}

我想知道问题出在哪里?

android android-gradle android-livedata
1个回答
11
投票
allprojects {
    repositories {
        google()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
        jcenter()

    }
}

您必须将google()作为第一行放在两个项目中,而不需要修改其他行,只需在开头添加google()即可。

© www.soinside.com 2019 - 2024. All rights reserved.