簡體   English   中英

如何修復 android.support 和 firebase 錯誤?

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

當我嘗試使用此項目設置我的 firebase 時發生此錯誤。 搜索后...我找到了一個解決方案,之后同步和構建都可以正常工作,並且應用程序可以在我的設備上運行。

但問題是:

  1. 我不明白要使用 android.support 和 firebase 的哪一對版本。
  2. 盡管該應用程序運行良好,但仍顯示紅色下划線。

謝謝您的幫助。
build.gradle(項目)

構建.gradle(應用程序)

AndroidManifest

構建.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(項目)

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
}

嘗試使用 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'

我希望它有幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM