Glide不能在不同的设备上运行,FileNotFoundException

时间:2018-01-16 19:38:43

标签: android kotlin android-glide

我从我正在开发的应用程序中得到了奇怪的行为。通常我在Pixel 2 XL上运行它,但现在我正在其他设备和API上测试它。使用Pixel 2 Xl和API 27我没有任何错误,但更改为我得到的其他API和/或设备:

Load failed for https://cryptocompare.com/media/12318177/ada.png with size [60x90]
                                                                        class com.bumptech.glide.load.engine.GlideException: Failed to load resource
                                                                        There was 1 cause:
                                                                        java.io.FileNotFoundException(https://cryptocompare.com/media/12318177/ada.png)
                                                                         call GlideException#logRootCauses(String) for more detail
                                                                          Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
                                                                        There was 1 cause:
                                                                        java.io.FileNotFoundException(https://cryptocompare.com/media/12318177/ada.png)
                                                                         call GlideException#logRootCauses(String) for more detail
                                                                            Cause (1 of 1): class java.io.FileNotFoundException: https://cryptocompare.com/media/12318177/ada.png

01-16 14:25:16.522 4661-4661/com.example.patrickhaller.cryptofolio I/Glide: Root cause (1 of 1)
                                                                        java.io.FileNotFoundException: https://cryptocompare.com/media/12318177/ada.png
                                                                            at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:251)
                                                                            at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
                                                                            at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(Unknown Source:0)
                                                                            at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:106)
                                                                            at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:59)
                                                                            at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:62)
                                                                            at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:299)
                                                                            at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:269)
                                                                            at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:230)
                                                                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
                                                                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
                                                                            at java.lang.Thread.run(Thread.java:764)

澄清一下,这里使用的Glide系列:

 val glideUrl = GlideUrl(baseUrl + url)
 Glide.with(context)
         .load(glideUrl)
         .transition(withCrossFade())
         .into(holder.logo!!)

我也和Volley一起尝试过,而不是Okhttp。

0 个答案:

没有答案