【问题标题】:Android - Firebase phone auth IncompatibleClassChangeErrorAndroid - Firebase 手机身份验证 IncompatibleClassChangeError
【发布时间】:2021-05-12 16:10:16
【问题描述】:

我正在尝试集成 firebase 电话身份验证,但在下方附加了 IncompatibleClassChangeError 堆栈跟踪,我还附加了我的根/应用级 Gradle 文件。

我用过

This code

来自 google 的 sn-p 存储库。

我已按照文档中所述正确执行每个步骤。

  1. 我添加了 sha1 和 sha256 指纹
  2. 我还尝试更正 Gradle 版本和 firebase 依赖,但没有成功。

错误日志:

我的应用级别分级

plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
    }

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
    applicationId "com.aihighway.aihscreening"
    minSdkVersion 21
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.airbnb.android:lottie:3.7.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.gordonwong:material-sheet-fab:1.2.1'
implementation 'com.github.AnyChart:AnyChart-Android:1.1.2'
implementation("com.squareup.okhttp3:okhttp:4.9.0")
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.github.MackHartley:RoundedProgressBar:2.1.0'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.google.firebase:firebase-auth:21.0.0'
implementation 'com.google.firebase:firebase-auth-ktx:21.0.0'
implementation 'com.google.firebase:firebase-core:19.0.0'

testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

我的根级 build.gradle

buildscript {
repositories {
    google()
    mavenCentral()
    maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:4.2.0'
    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()
    mavenCentral()
    maven { url 'https://plugins.gradle.org/m2/' }
    maven { url "https://jitpack.io" }
    }
}

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

【问题讨论】:

    标签: java android firebase google-api firebase-authentication


    【解决方案1】:

    我设法找到了解决方法,我将 firebase 版本降级到 20.0.0,它对我有用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-11
      • 1970-01-01
      • 2022-10-17
      • 2019-02-16
      相关资源
      最近更新 更多