내 앱을 실행할 때 런타임 중에 다음 오류가 발생합니다. java.lang.NoSuchMethodError : No virtual method setTokenProvider
Android Studio의 에뮬레이터에서 내 앱을 실행할 때이 오류가 발생합니다. 앱이 성공적으로 컴파일됩니다.
java.lang.NoSuchMethodError : Lcom / google / firebase / FirebaseApp 클래스에 가상 메소드 setTokenProvider (Lcom / google / firebase / internal / InternalTokenProvider;) V가 없습니다. 또는 수퍼 클래스 ( 'com.google.firebase.FirebaseApp'선언은 /data/app/~~_7zL9Id2RK7b6zEuTNlmiQ==/com.example.abc_supermarket-2V5eMXxz7SuahQK49NOpSw==/base.apk에 표시됨)
내 Gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.abc_supermarket"
minSdkVersion 14
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'com.google.firebase:firebase-database:19.5.0'
implementation 'com.google.firebase:firebase-storage:19.2.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// For Card view
implementation 'androidx.cardview:cardview:1.0.0'
// Chart and graph library
implementation 'com.github.blackfizz:eazegraph:1.2.5l@aar'
implementation 'com.nineoldandroids:library:2.4.0'
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
}
내 앱에 Firebase 저장소를 추가 한 후에 만 오류가 발생하기 시작했습니다. 나는이 오류에 대한 다른 게시물을 하나만 찾았으며 제공된 유일한 솔루션이 나를 위해 작동하지 않았습니다. 이 특정 오류에 대한 온라인 정보가 많지 않은 것 같아서 도움이 절실히 필요합니다. 모든 응답은 대단히 감사합니다 :)
추신. 저는 아직 Android Studio 작업에 익숙하지 않습니다.
답변
이전 Firebase 인증 및 최신 Firebase 저장소를 사용하고 있으며 Firebase 출시 노트에서 세부 정보를 제공 했기 때문일 수 있습니다 .
implementation 'com.google.firebase:firebase-auth:16.0.5'
이 업데이트의 주요 변경 사항 :
- Firebase 인증을 사용하는 경우 업데이트 된 다른 Firebase 라이브러리와 기능이 일치하도록 firebase-auth v17.0.0 이상으로 업데이트하세요.
- Google Play 서비스 배포 정책에 맞게 여러 라이브러리가 minSdkVersion을 API 레벨 16으로 업데이트했습니다.
- 프로젝트 수준 build.gradle 파일에서 buildscript 및 allprojects 섹션 모두에 Google의 Maven 저장소를 포함해야합니다.
새 버전의 Firebase 인증으로 변경하면됩니다.