标签:firebaseui android firebase firebase-authentication google-cloud-firestore
每当我将com.google.firebase:firebase-firestore:19.0.0添加到Gradle并运行应用程序时,都会出现以下错误.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: meter.meter, PID: 13588
java.lang.NoSuchMethodError: No virtual method setTokenProvider(Lcom/google/firebase/internal/InternalTokenProvider;)V in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/meter.meter-Qosf8nECYGfI4HI93CwJrw==/split_lib_dependencies_apk.apk!classes2.dex)
at com.google.firebase.auth.zzp.create(Unknown Source:4)
at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:firebase-common@@17.0.0:66)
at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4)
at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-common@@17.0.0:53)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:firebase-common@@17.0.0:155)
at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common@@17.0.0:642)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:358)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:321)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:305)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@17.0.0:53)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@17.0.0:47)
at android.app.ActivityThread.installProvider(ActivityThread.java:6391)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
摇篮:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.facebook.android:facebook-android-sdk:5.0.0'
implementation 'com.twitter.sdk.android:twitter-core:3.3.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.github.yalantis:ucrop:2.2.3-native'
def camerax_version = "1.0.0-alpha01"
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.google.firebase:firebase-firestore:19.0.0'
}
apply plugin: 'com.google.gms.google-services'
解决方法:
由于您使用的是最新版本的firestore,因此需要将以下依赖项添加到build.gradle:
implementation 'com.google.firebase:firebase-auth:17.0.0'
根据docs:
Authentication version 17.0.0
This update of firebase-auth is required to use new versions of
firebase-firestore
,firebase-functions
,firebase-storage
, andfirebase-database
going forward.
此外,由于firebase-ui-auth使用firebase auth的16.0.5
版本,然后添加您自己的firebase-auth实现,该实现将覆盖该版本.
所以你应该有以下依赖项:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.facebook.android:facebook-android-sdk:5.0.0'
implementation 'com.twitter.sdk.android:twitter-core:3.3.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.github.yalantis:ucrop:2.2.3-native'
def camerax_version = "1.0.0-alpha01"
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.google.firebase:firebase-firestore:19.0.0'
}
标签:firebaseui,android,firebase,firebase-authentication,google-cloud-firestore 来源: https://codeday.me/bug/20190827/1744581.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。