我在MyApplication.onCreate中遇到NoClassDefFoundError异常:
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory()
.cacheOnDisc()
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.defaultDisplayImageOptions(defaultOptions)
.build();
ImageLoader.getInstance().init(config);
1.8版的用户jar。 当我不使用DisplayImageOptions时,同样的问题(使用类com.nostra13.universalimageloader.core.ImageLoaderConfiguration $ Builder)
这是日志
05-18 12:46:28.217: E/dalvikvm(5481): Could not find class 'com.nostra13.universalimageloader.core.ImageLoaderConfiguration$Builder', referenced from method com.tappedin.TappedinApplication.initImageLoader
05-18 12:46:28.217: W/dalvikvm(5481): VFY: unable to resolve new-instance 81 (Lcom/nostra13/universalimageloader/core/ImageLoaderConfiguration$Builder;) in Lcom/tappedin/TappedinApplication;
05-18 12:46:28.217: D/dalvikvm(5481): VFY: replacing opcode 0x22 at 0x0000
05-18 12:46:28.217: D/dalvikvm(5481): VFY: dead code 0x0002-0014 in Lcom/tappedin/TappedinApplication;.initImageLoader ()V
05-18 12:46:28.217: D/AndroidRuntime(5481): Shutting down VM
05-18 12:46:28.217: W/dalvikvm(5481): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
05-18 12:46:28.257: E/AndroidRuntime(5481): FATAL EXCEPTION: main
05-18 12:46:28.257: E/AndroidRuntime(5481): java.lang.NoClassDefFoundError: com.nostra13.universalimageloader.core.ImageLoaderConfiguration$Builder
05-18 12:46:28.257: E/AndroidRuntime(5481): at com.tappedin.TappedinApplication.initImageLoader(TappedinApplication.java:20)
05-18 12:46:28.257: E/AndroidRuntime(5481): at com.tappedin.TappedinApplication.onCreate(TappedinApplication.java:12)
05-18 12:46:28.257: E/AndroidRuntime(5481): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:984)
05-18 12:46:28.257: E/AndroidRuntime(5481): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3921)
05-18 12:46:28.257: E/AndroidRuntime(5481): at android.app.ActivityThread.access$2200(ActivityThread.java:135)
05-18 12:46:28.257: E/AndroidRuntime(5481): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1098)
05-18 12:46:28.257: E/AndroidRuntime(5481): at android.os.Handler.dispatchMessage(Handler.java:99)
05-18 12:46:28.257: E/AndroidRuntime(5481): at android.os.Looper.loop(Looper.java:150)
05-18 12:46:28.257: E/AndroidRuntime(5481): at android.app.ActivityThread.main(ActivityThread.java:4389)
05-18 12:46:28.257: E/AndroidRuntime(5481): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 12:46:28.257: E/AndroidRuntime(5481): at java.lang.reflect.Method.invoke(Method.java:507)
05-18 12:46:28.257: E/AndroidRuntime(5481): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
05-18 12:46:28.257: E/AndroidRuntime(5481): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
05-18 12:46:28.257: E/AndroidRuntime(5481): at dalvik.system.NativeStart.main(Native Method)