在最新的Firebase版本(10.2.4)中使用Glide和FirebaseUI加载图像

时间:2017-05-08 17:16:30

标签: android firebase firebase-storage android-glide firebaseui

因此我将firebase更新到最新版本(10.2.4)以及playservices,突然我的应用程序加载了Glide的所有图像都不再加载。 如果我在build.gradle中有这个

ext {
    supportLibraryVersion = '25.3.1'
    firebaseLibraryVersion = '10.2.1'
    playServicesLibraryVersion = '10.2.1'
}

dependencies {
    // play services
    compile "com.google.android.gms:play-services-places:$playServicesLibraryVersion"
    compile "com.google.android.gms:play-services-auth:$playServicesLibraryVersion"
    // firebase
    compile "com.google.firebase:firebase-storage:$firebaseLibraryVersion"
    // ...
}

运行此行Code of Fine。

Glide.with(mContext).using(new FirebaseImageLoader()).load(storageReference).into(viewHolder.profileImage);

但是,如果我将firebase和play服务设置为最新版本:

ext {
    supportLibraryVersion = '25.3.1'
    firebaseLibraryVersion = '10.2.4'
    playServicesLibraryVersion = '10.2.4'
}

然后上面的行不再起作用了。它根本不加载图像。 我将代码更改为此,以便查看错误可能是什么:

    Glide.with(mContext)
            .using(new FirebaseImageLoader())
            .load(storageReference)
            .listener(new RequestListener<StorageReference, GlideDrawable>() {
        @Override
        public boolean onException(Exception e, StorageReference model, Target<GlideDrawable> target, boolean isFirstResource) {
            Log.d(TAG, "exception " + e.getMessage());
            e.printStackTrace();
            return false;
        }

        @Override
        public boolean onResourceReady(GlideDrawable resource, StorageReference model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
            return false;
        }
    }).into(viewHolder.mProfileImage);

我收到此日志声明:

Could not open resulting stream.

和这个例外:

  W/System.err: java.io.IOException: Could not open resulting stream.
05-08 19:10:04.513 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.google.firebase.storage.StreamDownloadTask.zzacI(Unknown Source)
05-08 19:10:04.513 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.google.firebase.storage.StreamDownloadTask.zza(Unknown Source)
05-08 19:10:04.513 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.google.firebase.storage.StreamDownloadTask$1.zzacK(Unknown Source)
05-08 19:10:04.513 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.google.firebase.storage.StreamDownloadTask$1.call(Unknown Source)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.google.firebase.storage.StreamDownloadTask$zza.zzacM(Unknown Source)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.google.firebase.storage.StreamDownloadTask$zza.read(Unknown Source)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at java.io.BufferedInputStream.read(BufferedInputStream.java:290)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:166)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:229)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$StreamReader.getUInt16(ImageHeaderParser.java:334)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.resource.bitmap.ImageHeaderParser.getType(ImageHeaderParser.java:87)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder$ImageTypeParser.parse(GifBitmapWrapperResourceDecoder.java:147)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decodeStream(GifBitmapWrapperResourceDecoder.java:82)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:71)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:61)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:22)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.engine.DecodeJob.decodeFromSourceData(DecodeJob.java:190)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.engine.DecodeJob.decodeSource(DecodeJob.java:177)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.engine.DecodeJob.decodeFromSource(DecodeJob.java:128)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.engine.EngineRunnable.decodeFromSource(EngineRunnable.java:122)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:101)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at java.lang.Thread.run(Thread.java:818)
05-08 19:10:04.514 8839-8839/com.gmail.linxydev.clientapp W/System.err:     at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118)

回到版本10.2.1修复了问题,但是可能还有其他修复方法吗?我在2个设备上测试了这个,一个运行android 6而另一个运行7,它发生在两个设备上。

1 个答案:

答案 0 :(得分:0)

对我而言,这似乎是fixed,最新的11.0.1版本与firebase-ui-2.0.1结合使用。我不知道发生了什么变化。