无法解决:livedata-core

时间:2018-09-16 17:36:46

标签: android android-gradle android-livedata

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

  

无法解决:livedata-core

     

打开文件

     

无法解决:livedata-core

     

打开文件

它引用项目的两个文件(build.gradle) 一个是这个:

classdef NamedConst
   properties (Constant)
      R = pi/180; % Can't define it in constructor body, because it is `Constant properties`
  end
  %class body
end

另一个是这个:

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

我想知道问题出在哪里吗?

1 个答案:

答案 0 :(得分:11)

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

    }
}

您必须将google()作为两个项目的第一行,并且无需修改其他行,只需在开始处添加google()