简体   繁体   English

添加Firebase连接时,为什么在实现'com.android.support:appcompat-v7:28.0.0'时出现错误?

[英]Why I am having ERROR on implementation 'com.android.support:appcompat-v7:28.0.0' when adding Firebase connection?

When I modify my build.gradle files to use the Firebase plugin, It shows me an error on implementation 'com.android.support:appcompat-v7:28.0.0' 当我修改build.gradle文件以使用Firebase插件时,它显示了实现'com.android.support:appcompat-v7:28.0.0'的错误

I have already added the google-services.json file into my Android app module root directory. 我已经将google-services.json文件添加到了Android应用模块的根目录中。

My error: Issue ID= Gradle compatible 我的错误:问题ID = Gradle兼容

All com.android.support libraries must have the exact same version specification...Found versions 28.0.0,26.1.0. 所有com.android.support库都必须具有完全相同的版本规范...找到的版本28.0.0,26.1.0。 Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0 示例包括com.android.support:animated-vector-drawable:28.0.0和com.android.support:support-media-compat:26.1.0

I have tried to comment it out: 我试图将其注释掉:

//noinspection GradleCompatible

implementation 'com.android.support:appcompat-v7:28.0.0'

But also it didn't work it cant communicate with firebase servers 但它也无法正常工作,无法与Firebase服务器通信

apply plugin: 'com.android.application'

android {
compileSdkVersion 28

defaultConfig {
    applicationId "com.example.android.tinder"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.lorentzos.swipecards:library:1.0.9'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.1.0'
}
apply plugin: 'com.google.gms.google-services'

My build.gradle code(Project) 我的build.gradle代码(项目)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.2.0'

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

allprojects {
repositories {
    google()
    jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
 }

I just expect to be able to connect my Firebase to my android app 我只是希望能够将Firebase连接到我的android应用

The solution is: 解决方案是:

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'

implementation 'com.android.support:support-media-compat:28.0.0' // NEED TO ADD
implementation 'com.android.support:support-v4:28.0.0' //NEED TO ADD

implementation 'com.google.firebase:firebase-storage:16.0.5'

I solved my problem by changing the version of Fire-base and classpath dependencies. 我通过更改Fire-baseclasspath依赖项的版本解决了我的问题。

The latest version of dependencies conflicted with implementation 'com.android.support:appcompat-v7:28.0.0' in App level build.gradle . 最新版本的依赖项与应用程序级别build.gradle implementation 'com.android.support:appcompat-v7:28.0.0'冲突。

My changes are given below 我的更改如下

  • implementation 'com.google.firebase:firebase-core:17.0.1' to implementation 'com.google.firebase:firebase-core:16.0.8' in App level build.gradle file. 在应用程序级别build.gradle文件implementation 'com.google.firebase:firebase-core:16.0.8' implementation 'com.google.firebase:firebase-core:17.0.1' implementation 'com.google.firebase:firebase-core:16.0.8'

  • classpath 'com.google.gms:google-services:4.3.0' to classpath 'com.google.gms:google-services:4.2.0' in Project level build.gradle file. 项目级build.gradle文件中的classpath 'com.google.gms:google-services:4.3.0'classpath 'com.google.gms:google-services:4.2.0'

* If you migrate your project to AndroidX, then you will be able to use all the latest dependencies without facing this kind of errors * *如果将项目迁移到AndroidX,那么您将能够使用所有最新的依赖项而不会遇到此类错误*

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 实施 'com.android.support:appcompat-v7:28.0.0' - 错误 - implementation 'com.android.support:appcompat-v7:28.0.0' - Error 为什么我在此代码实现&#39;com.android.support:appcompat-v7:27.1.1&#39;时出错 - Why i am getting error on this code implementation 'com.android.support:appcompat-v7:27.1.1' 实现&#39;com.android.support:appcompat-v7:28.0.0&#39;显示错误 - implementation 'com.android.support:appcompat-v7:28.0.0' showing an error 错误崩溃实现&#39;com.android.support:appcompat-v7:28.0.0&#39; - error crash implementation 'com.android.support:appcompat-v7:28.0.0' 实现&#39;com.android.support:appcompat-v7:28.0.0-beta01&#39;显示错误 - implementation 'com.android.support:appcompat-v7:28.0.0-beta01' showing error 找不到参数[com.android.support:appcompat-v7:28.0.0]的方法Implementation() - Could not find method implementation() for arguments [com.android.support:appcompat-v7:28.0.0] gradle 构建错误:无法解析 com.android.support:appcompat-v7:28.0.0 - gradle build error: Could not resolve com.android.support:appcompat-v7:28.0.0 我收到错误消息&#39;编译&#39;com.android.support:design:23.0.1&#39;编译&#39;com.android.support:appcompat-v7:23.0.1&#39; - I am getting the error' compile 'com.android.support:design:23.0.1' compile 'com.android.support:appcompat-v7:23.0.1' &#39;实施&#39;com.android.support:appcompat-v7:27.1.1&#39;问题 - 'Implementation 'com.android.support: appcompat-v7:27.1.1' issue Android Studio <Failed to resolve: com.android.support:appcompat-v7:28.0.0> - Android Studio <Failed to resolve: com.android.support:appcompat-v7:28.0.0>
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM