public class KApplication extends Application{
public ImageLoader mImageLoader;
public DisplayImageOptions mOptions;
private ImageLoaderConfiguration mConfig;
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
Log.i("Application class oncreate", "Application onCreate 동작");
Context context = getApplicationContext();
File cacheDir = StorageUtils.getCacheDirectory(context); //오류 문제의 부분
mConfig = new ImageLoaderConfiguration.Builder(context)
.threadPoolSize(2)
.threadPriority(Thread.NORM_PRIORITY - 1)
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.memoryCacheSizePercentage(13) // default
.discCache(new UnlimitedDiscCache(cacheDir)) // default
.discCacheSize(50 * 1024 * 1024)
.discCacheFileCount(100)
.discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
.denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
.tasksProcessingOrder(QueueProcessingType.FIFO)
.writeDebugLogs() // Remove for release app
.build();
// Initialize ImageLoader with configuration.
mOptions = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.ic_launcher)
.showImageForEmptyUri(R.drawable.ic_launcher)
.showImageOnFail(R.drawable.ic_launcher)
.cacheInMemory(true)
.cacheOnDisc(true)
// .handler(new Handler()) // default 생성시 퀵서치 부분에서 오류가 발생하여 주석 처리 함.
// .displayer(new RoundedBitmapDisplayer(0))
.build();
mImageLoader = ImageLoader.getInstance();
mImageLoader.init(mConfig);
}
}
위의 context를 전달하는 cacheDir 부분에서 오류가 발생합니다.
현재 Application Class인데 Application Class에서는 context를 사용할 수 없나요?
원인 파악이 안되네요 ㅠㅠ
java.lang.NoClassDefFoundError: com.nostra13.universalimageloader.utils.StorageUtils
오류가 발생하는데..
context 문제가 아니라 클래스 파일을 못찾는건지..
유니버셜 라이브러리 패스도 잘 설정되어 있는데 말이죠;