2013-11-28 132 views
0

林尝试使用这个库:WebCachedImageView初始化错误

https://github.com/leocadiotine/WebCachedImageView/

林使用仿真器,API等级17,加WebCachedImageView到的ListView扔ListViewAdapter

public View getView(int pos, View child, ViewGroup parent) { 
    Holder mHolder; 
    LayoutInflater layoutInflater; 
    if (child == null) { 
     layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     child = layoutInflater.inflate(R.layout.sent_listview_item, null); 
     mHolder = new Holder(); 
     mHolder.txt_fileName = (TextView) child.findViewById(R.id.txt_sentLV_fileName); 
     mHolder.img_preview  = (WebCachedImageView) child.findViewById(R.id.wciv); 
     child.setTag(mHolder); 
    } else { 
     mHolder = (Holder) child.getTag(); 
    } 
    mHolder.txt_fileName.setText(fileName.get(pos)); 
    return child; 
} 

public class Holder { 
    WebCachedImageView img_preview; 
    TextView txt_fileName; 
} 

而且我得到这个错误:

11-28 15:47:51.767: ERROR/AndroidRuntime(1432): FATAL EXCEPTION: AsyncTask #1 
    java.lang.RuntimeException: An error occured while executing doInBackground() 
    at android.os.AsyncTask$3.done(AsyncTask.java:299) 
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 
    at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:239) 
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 
    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:856) 
    Caused by: java.lang.NoClassDefFoundError: com.jakewharton.DiskLruCache 
    at io.leocad.webcachedimageview.CacheManager$2.doInBackground(CacheManager.java:93) 
    at io.leocad.webcachedimageview.CacheManager$2.doInBackground(CacheManager.java:86) 
    at android.os.AsyncTask$2.call(AsyncTask.java:287) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
    ... 4 more 

我在此发生错误:

mDiskCache = DiskLruCache.open(cacheDir, 1, 1, DISK_CACHE_SIZE); https://github.com/leocadiotine/WebCachedImageView/blob/master/code/src/io/leocad/webcachedimageview/CacheManager.java#L93

Plase帮我

回答