通用图像加载器 - 图像无法解码 - > .imageDecoder问题

时间:2015-06-01 13:08:11

标签: android android-studio universal-image-loader

我收到错误E/ImageLoader﹕ Image can't be decoded。我在这里找到了一个解决方案https://github.com/nostra13/Android-Universal-Image-Loader/issues/539。一个人说复制课程NutraBaseImageDecoder并将.imageDecoder(new NutraBaseImageDecoder(true))添加到选项中,但是当我尝试添加它时,它无法识别.imageDecoder。我究竟做错了什么 ?

这是我尝试过的:

 options = new DisplayImageOptions.Builder()
                    .showImageOnLoading(R.drawable.ic_empty)
                    .showImageForEmptyUri(R.drawable.ic_empty)
                    .showImageOnFail(R.drawable.ic_error)
                    .cacheInMemory(true)
                    .cacheOnDisk(true)
                    .imageDecoder(new NutraBaseImageDecoder(true))
                    .considerExifParams(true)
                    .displayer(new RoundedBitmapDisplayer(20)).build();

问题在于.imageDecoder(new NutraBaseImageDecoder(true))。网址中没有空格。当我在图像加载器中传递它时,我在Uri.decode(url)中也有这个。

编辑错误:

    06-01 14:12:14.746  13047-14716/name.company.newproject I/System.out﹕ AsyncTask #3 calls detatch()
06-01 14:12:14.766  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:14.766  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:14.766  13047-13454/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:14.826  13047-13455/name.company.newproject D/dalvikvm﹕ GC_FOR_ALLOC freed 3151K, 17% free 21796K/26124K, paused 22ms, total 22ms
06-01 14:12:14.836  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:14.836  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:14.836  13047-13455/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:14.856  13047-13452/name.company.newproject D/dalvikvm﹕ GC_FOR_ALLOC freed 716K, 17% free 21817K/26124K, paused 24ms, total 24ms
06-01 14:12:14.926  13047-13452/name.company.newproject D/dalvikvm﹕ GC_FOR_ALLOC freed 62K, 15% free 22330K/26124K, paused 24ms, total 24ms
06-01 14:12:14.946  13047-13047/name.company.newproject D/AbsListView﹕ unregisterIRListener() is called
06-01 14:12:15.446  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.446  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.446  13047-13454/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:15.456  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.456  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.456  13047-13452/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:15.506  13047-13047/name.company.newproject D/AbsListView﹕ unregisterIRListener() is called
06-01 14:12:15.576  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.576  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.576  13047-13455/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:15.576  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.576  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.576  13047-13454/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:15.616  13047-13047/name.company.newproject D/AbsListView﹕ unregisterIRListener() is called
06-01 14:12:15.666  13047-13047/name.company.newproject D/AbsListView﹕ unregisterIRListener() is called
06-01 14:12:15.896  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.896  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.896  13047-13452/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:15.896  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.896  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:15.896  13047-13455/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:16.096  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.096  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.096  13047-13454/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:16.096  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.096  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.096  13047-13452/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:16.656  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.656  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.656  13047-13455/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:16.656  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.656  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.656  13047-13454/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:16.846  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.846  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.846  13047-13452/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:16.856  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.856  13047-13455/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:16.856  13047-13455/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:17.056  13047-13455/name.company.newproject D/dalvikvm﹕ GC_FOR_ALLOC freed 4815K, 21% free 23079K/29068K, paused 22ms, total 22ms
06-01 14:12:17.316  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:17.316  13047-13454/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:17.316  13047-13454/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:17.316  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:17.316  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:17.316  13047-13452/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]
06-01 14:12:18.116  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:18.116  13047-13452/name.company.newproject D/skia﹕ --- SkImageDecoder::Factory returned null
06-01 14:12:18.116  13047-13452/name.company.newproject E/ImageLoader﹕ Image can't be decoded [httpURL]

图像为2.6 MB。

1 个答案:

答案 0 :(得分:0)

您不必将/var/run/varnish.pid.imageDecoder(new NutraBaseImageDecoder(true))放在一起,而DisplayImageOptions.Builder()ImageLoaderConfiguration一样:

ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            .memoryCache(new WeakMemoryCache())
            .imageDecoder(new NutraBaseImageDecoder(true))
            .writeDebugLogs()
            .build();

ImageLoader.getInstance().init(config);