简体   繁体   English

如何修复 android.support 和 firebase 错误?

[英]how to fix android.support and firebase error?

this error occurred when I tried to set up my firebase with this project.当我尝试使用此项目设置我的 firebase 时发生此错误。 after searching...I found a solution which after then both synced and build works fine and the app run on my device.搜索后...我找到了一个解决方案,之后同步和构建都可以正常工作,并且应用程序可以在我的设备上运行。

But the problem is that:但问题是:

  1. I don't understand which pair version of android.support and firebase to use.我不明白要使用 android.support 和 firebase 的哪一对版本。
  2. though the app works fine it's still showing red underlined.尽管该应用程序运行良好,但仍显示红色下划线。

Thanks for the help.谢谢您的帮助。
build.gradle(project) build.gradle(项目)

build.gradle(app)构建.gradle(应用程序)

AndroidManifest AndroidManifest

build.gradle(app)构建.gradle(应用程序)

apply plugin: 'com.android.application'

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

dependencies {
implementation 'com.google.firebase:firebase-analytics:15.0.0'
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'
}
 apply plugin: 'com.google.gms.google-services'

build.gradle(project) build.gradle(项目)

buildscript {
repositories {
    google()
    jcenter()

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

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

Try to use upgrade version of firebase-analtyics.尝试使用 firebase-analtyics 的升级版本。

implementation 'com.google.firebase:firebase-analytics:16.0.0'
classpath 'com.google.gms:google-services:4.2.0'

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

I hope it helps我希望它有帮助

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

相关问题 错误:无法解析:android.support:support.v7:29.0.2 - ERROR: Failed to resolve: android.support:support.v7:29.0.2 如何使用Eclipse在build.gradle中包含android.support - How to include android.support in build.gradle using Eclipse 导入android.support无法解析 - The import android.support cannot be resolved 如何使用 Android 和 Firebase 修复此错误 - How to fix this error with Android and Firebase android.support 库必须使用完全相同的版本规范 - android.support libraries must use the exact same version specification IntelliJ:为什么无法识别我的android.support软件包? - IntelliJ: why my android.support package isn't recognized? 如何修复错误包android.support.v7不存在? - How to fix error package android.support.v7 does not exist? 如何修复android中的“无法访问android.support.v4.app.ActivityCompat未找到的ActivityCompat类文件”错误? - How to fix "cannot access ActivityCompat class file for android.support.v4.app.ActivityCompat not found" error in android? 如何修复 Java 中的“找不到以下类:-android.support.v7.widget.Toolbar”错误 - How to fix 'The following classes could not be found: - android.support.v7.widget.Toolbar' error in Java 如何修复“错误夸大类android.support.design.widget.NavigationView” - How to fix “Error inflating class android.support.design.widget.NavigationView”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM