0

android에서 Universal Image Loader Library를 사용하고 있습니다. 완벽하게 작동하지만 다음 오류가 발생합니다.유니버설 이미지 로더 사용시 EOFException이 발생했습니다.

E/ImageLoader﹕ null 
java.io.EOFException 
     at libcore.io.Streams.readAsciiLine(Streams.java:203) 
     at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579) 
     at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827) 
     at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283) 
     at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497) 
     at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromNetwork(BaseImageDownloader.java:117) 
     at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:88) 
     at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:291) 
     at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisk(LoadAndDisplayImageTask.java:274) 
     at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:230) 
     at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
     at java.lang.Thread.run(Thread.java:841) 

다음 코드는 Application 클래스에 있습니다.

DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() 
      .resetViewBeforeLoading(true) 
      .cacheOnDisk(true) 
      .cacheInMemory(true) 
      .showImageForEmptyUri(R.mipmap.fico_not_found) 
      .showImageOnFail(R.mipmap.fico_not_found) 
      .displayer(new FadeInBitmapDisplayer(300)) 
      .build(); 

    ImageLoaderConfiguration config1 = new ImageLoaderConfiguration.Builder(getApplicationContext()) 
      .defaultDisplayImageOptions(defaultOptions) 
      .memoryCache(new WeakMemoryCache()) 
      .diskCacheSize(100 * 1024 * 1024) 
      .build(); 

    this.imageLoader = ImageLoader.getInstance(); 
    imageLoader.init(config1); 

그리고 내가 어댑터 클래스에 다음 코드를 사용하여이는

imageLoader = ((Application)context.getApplicationContext()).getImageLoader(); 
imageLoader.displayImage(Utils.IMAGE_URL + image_name,parentViewHolder.logo); 

사람이 같은 오류를 가지고 있습니까? 이것에 관한 도움을 주시면 감사하겠습니다.

+0

UIL libaray를 사용하는 이유는 무엇입니까? 그들은 더 이상 그 도서관을 유지하지 않습니다. 활공이나 피카소를 사용해보십시오. –

+0

Piccaso : http : //www.picasso.fr/us/picasso_page_index.php 글라이드 : https : //github.com/bumptech/glide –

+0

@ ZeeshanShabbir- 피카소를 사용했지만 캐시를 관리 할 방법이 없습니다. 나는 UIL을 사용하고있다. –

답변

0

잘 설명 된 답변이 아닙니다. 일부 최신 버전의 안드로이드에는 재활용 된 URL 연결 버그가 있습니다. 이 문제를 해결하려면 성능 문제가있을 수 있지만 다음을 추가해야합니다.

if (Build.VERSION.SDK != null && Build.VERSION.SDK_INT > 13) { 
    urlConnect.setRequestProperty("Connection", "close"); //set URL connection property 
}