简体   繁体   中英

Android - Firebase phone auth IncompatibleClassChangeError

I am trying to integrate the firebase phone authentication but getting IncompatibleClassChangeError stack trace attached beloew, I have attached my root/app level Gradle files as well.

I have used

This code

from google's snippet repository.

I have followed each step correctly as mentioned in the documentation.

  1. I have added sha1 and sha256 fingerprints
  2. I have also tried to correct Gradle version and firebase dependency with no luck.

Error Log:

在此处输入图像描述

My app level gradle

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

My root level 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
}

I've managed to find a workaround, I downgraded the firebase version to 20.0.0 and it worked for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM