Не удается разрешить метод с помощью (com.firebase.ui.storage.images.FirebaseImageLoader)

Я пытаюсь использовать потрясающую интеграцию Glide, предоставляемую FirebaseUI, но не могу этого сделать.

Я выполнил все, что описано здесь: Загрузка изображений с помощью FirebaseUI

Не удается разрешить метод using(com.ui.firebase.storage.images.FirebaseImageLoader)

это ошибка, которую я сейчас получаю.

Хороши ли мои настройки?

Вот версии двух библиотек, которые я использую:

  • Скольжение 4.0.0-RC1

  • FirebaseUI 2.0.1

И это мой град (приложение):

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.firebase:geofire-android:2.1.1'
    compile 'com.google.android.gms:play-services-location:11.0.1'
    compile 'com.android.support:design:25.3.1'

    implementation 'com.google.firebase:firebase-database:11.0.1'
    implementation 'com.android.support:cardview-v7:25.3.1'
    compile 'com.firebaseui:firebase-ui-storage:2.0.1'
    compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
    compile 'com.android.support:support-v4:25.3.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
    implementation 'com.google.firebase:firebase-storage:11.0.1'
    implementation 'com.google.firebase:firebase-auth:11.0.1'

}

apply plugin: 'com.google.gms.google-services'

person reavcn    schedule 29.06.2017    source источник


Ответы (3)


К сожалению, FirebaseUI еще не поддерживает Glide 4.0, поэтому у вас есть два варианта:

  1. Понизьте уровень планирования до v3.8.0
  2. Напишите свой собственный модуль Glide. Вы можете увидеть мой ответ здесь о том, как вы будете действовать обновление кода хранилища FirebaseUI.

Эта проблема отслеживается здесь: https://github.com/firebase/FirebaseUI-Android/issues/731

Изменить: по ссылке выше проблема была решена в версии 3.0.

person SUPERCILEX    schedule 04.07.2017

Вы должны включить firebase-ui-storage в свои зависимости Gradle (/app/build.gradle) следующим образом:

dependencies {

    implementation 'com.firebaseui:firebase-ui-storage:6.2.1'
}

Проверьте: последняя версия этой библиотеки

Затем импортируйте пакет:

import com.firebase.ui.storage.images.FirebaseImageLoader;
person Tork    schedule 20.05.2020

Это случилось со мной, и я решил это с помощью:

// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:3.3.0'
// Glide
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

Вот MyAppGlideModule, который должен расширить AppGlideModule. Крайне важно переопределить функцию «registerComponents»:

@GlideModule
public final class MyAppGlideModule extends AppGlideModule {
  @Override
  public void registerComponents(Context context, Glide glide, Registry 
  registry) {
    // Register FirebaseImageLoader to handle StorageReference
    registry.append(StorageReference.class, InputStream.class,
            new FirebaseImageLoader.Factory());
}

}

И функция, которая собственно скачивает изображение:

import com.app.path.where.the.myappglidemodule.is.GlideApp;
"Ex: import com.firebase.uidemo.storage.GlideApp  //In case MyAppGlideModule is inside storage package"

public void downloadDirect(StorageReference imageRef, ImageView imageView) {
    try {
        if (imageRef != null) {
            // Download directly from StorageReference using Glide
            // (See MyAppGlideModule for Loader registration)
            GlideApp.with(this)
                    .load(imageRef)
                    .centerCrop()
                    .transition(DrawableTransitionOptions.withCrossFade())
                    .into(imageView);
        } else {
            Log.e(TAG, "Null image storage reference!");
        }
    }catch (Exception ex){
        Log.e(TAG, ex.toString());
    }
}
person Javier Anton Rabade    schedule 09.05.2018