我正在尝试从我上传到Cloud Storage的名为art0.jpg的图像下载URL。该存储桶有两个文件夹,图像位于名为Arts的文件夹内。每当我运行我的应用程序时,它都会崩溃,并且我得到的异常/跟踪如下:
java.lang.NoSuchMethodError: No virtual method getToken(Z)Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.gammapi.dokkancardsonline-dcDgng_RjmbeJTVo_mDVqA==/base.apk)
at com.google.firebase.storage.internal.Util.getCurrentAuthToken(com.google.firebase:firebase-storage@@16.0.5:148)
at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(com.google.firebase:firebase-storage@@16.0.5:65)
at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(com.google.firebase:firebase-storage@@16.0.5:57)
at com.google.firebase.storage.GetDownloadUrlTask.run(com.google.firebase:firebase-storage@@16.0.5:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
导致崩溃的部分:
storageRef.child("Arts/art0.jpg")
.downloadUrl.addOnSuccessListener { uri ->
//GlideApp.with(cntxt).load(uri).into(imageView)
Log.d(TAG,"$uri")
}.addOnFailureListener {
Log.d(TAG,"ERROR DOWNLOADING IMAGE")
}
app.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "id"
minSdkVersion 21
targetSdkVersion 29
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'])
kapt 'com.android.support:support-annotations:28.0.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation "com.google.firebase:firebase-database:19.2.0"
implementation "com.google.android.gms:play-services-maps:17.0.0"
implementation 'com.github.bumptech.glide:annotations:4.8.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
implementation "com.github.bumptech.glide:okhttp3-integration:4.6.1"
implementation 'com.github.bumptech.glide:annotations:4.8.0'
implementation "com.google.firebase:firebase-core:17.2.1"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.firebaseui:firebase-ui-storage:4.3.1'
implementation 'com.google.firebase:firebase-firestore:21.2.1'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.android.support:support-annotations:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
现在我看了各种帖子(我知道很多),尽管实现了他们提到的所有依赖关系,但我仍然无法正常工作。编译器找不到哪种方法?如果是getToken(Z)
,因为这是内部的,我该怎么做才能克服此问题?
您正在使用com.firebaseui:firebase-ui-storage的旧版本。此时的最新值为according to GitHub为6.0.2。