Android P错误:无法解决依赖问题

时间:2018-03-12 05:58:42

标签: android gradle android-9.0-pie

更新目标版本P后收到错误

  

错误:无法解析':app @ debug / compileClasspath'的依赖关系:无法解析com.google.firebase:firebase-analytics:11.8.0。   打开文件
显示细节

1.我在项目gradle文件中添加了google()

2.我还通过同步和清理项目来检查。

我检查了以下链接

Unable to resolve all dependencies in android studio

Unable to resolve dependency Android Studio 3.0

1.App/Gradle

    apply plugin: 'com.android.application'
    apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
    apply plugin: 'io.fabric'

    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }
    android {
compileSdkVersion 'android-P'
        defaultConfig {
            applicationId 'com.ctdiindia.b2b'
            minSdkVersion 15
    targetSdkVersion 'P'
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true

        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
            debug {
                debuggable true
            }
        }
        buildToolsVersion '27.0.3'
        productFlavors {
        }
        compileOptions {
            targetCompatibility JavaVersion.VERSION_1_8
            sourceCompatibility JavaVersion.VERSION_1_8
        }

    }

    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:27.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        //Testing
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
        testCompile 'org.mockito:mockito-all:1.10.19'
        // Firebase
        compile 'com.google.firebase:firebase-analytics:11.8.0'
        compile 'com.google.firebase:firebase-database:11.8.0'
        compile 'com.google.firebase:firebase-storage:11.8.0'
        compile 'com.google.firebase:firebase-messaging:11.8.0'
        compile 'com.google.firebase:firebase-core:11.8.0'
        // Firebase UI
        compile 'com.firebaseui:firebase-ui-database:3.1.0'
        //Reycycler View
        implementation 'com.android.support:recyclerview-v7:27.1.0'
        implementation 'com.android.support:design:27.1.0'
        implementation 'com.android.support:cardview-v7:27.1.0'
        //Networking
        implementation 'com.google.code.gson:gson:2.8.2'
        compile 'com.amitshekhar.android:android-networking:1.0.1'
        //Observabale librares
        compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
        compile 'io.reactivex.rxjava2:rxjava:2.1.8'
    }
    apply plugin: 'com.google.gms.google-services'

2,项目/摇篮

    buildscript {

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

        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
            classpath 'com.google.gms:google-services:3.1.1'


            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
            maven { url "https://jitpack.io" }


        }
    }

有人有这个类似的问题吗?

2 个答案:

答案 0 :(得分:1)

代替:

compile 'com.google.firebase:firebase-analytics:11.8.0'

使用:

implementation 'com.google.firebase:firebase-analytics:11.8.0'

答案 1 :(得分:0)

使用此

yum install procps

而不是这个

com.google.firebase:firebase-core:11.8.0

FROM DOCScompile 'com.google.firebase:firebase-analytics:11.8.0' com.google.firebase:firebase-core库的推荐别名。

  

以下库可用于各种Firebase功能。

com.google.firebase:firebase-analytics