我的意图是读取原始资源,然后使用JSON将其转换为Java代码。执行此操作的类和外部库存储在另一个项目中。当我运行我的应用程序时,在日志猫中出现此错误:
06-08 13:51:34.680: WARN/dalvikvm(563): Unable to resolve superclass of Lnet/sf/json/JSONException; (297) 06-08 13:51:34.680: WARN/dalvikvm(563): Link of class 'Lnet/sf/json/JSONException;' failed 06-08 13:51:34.690: WARN/dalvikvm(563): VFY: unable to resolve exception class 186 (Lnet/sf/json/JSONException;) 06-08 13:51:34.690: WARN/dalvikvm(563): VFY: unable to find exception handler at addr 0x2e 06-08 13:51:34.690: WARN/dalvikvm(563): VFY: rejected Lnet/sf/json/JSONSerializer;.toJSON (Ljava/lang/Object;Lnet/sf/json/JsonConfig;)Lnet/sf/json/JSON; 06-08 13:51:34.700: WARN/dalvikvm(563): VFY: rejecting opcode 0x0d at 0x002e 06-08 13:51:34.700: WARN/dalvikvm(563): VFY: rejected Lnet/sf/json/JSONSerializer;.toJSON (Ljava/lang/Object;Lnet/sf/json/JsonConfig;)Lnet/sf/json/JSON; 06-08 13:51:34.700: WARN/dalvikvm(563): Verifier rejected class Lnet/sf/json/JSONSerializer; 06-08 13:51:34.710: DEBUG/AndroidRuntime(563): Shutting down VM 06-08 13:51:34.710: WARN/dalvikvm(563): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): FATAL EXCEPTION: main 06-08 13:51:34.730: ERROR/AndroidRuntime(563): java.lang.VerifyError: net.sf.json.JSONSerializer 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at fliphouse.JSONUtils.setup(JSONUtils.java:67) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at ie.fliphouse.luas.LuasUtils.readJSON(LuasUtils.java:130) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at ie.fliphouse.luas.ZoneList.onCreate(ZoneList.java:51) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at android.os.Handler.dispatchMessage(Handler.java:99) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at android.os.Looper.loop(Looper.java:123) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at android.app.ActivityThread.main(ActivityThread.java:4627) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at java.lang.reflect.Method.invokeNative(Native Method) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at java.lang.reflect.Method.invoke(Method.java:521) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 06-08 13:51:34.730: ERROR/AndroidRuntime(563): at dalvik.system.NativeStart.main(Native Method) 06-08 13:51:34.740: WARN/ActivityManager(59): Force finishing activity ie.fliphouse.luas/.ZoneList
我可以说该错误是由JSONArray的创建引起的。我已经在stackoverflow上遇到过此错误,但是没有明确的方法来解决此问题。任何人都可以向我推荐解决此问题的方法。帮助将不胜感激。
您正在添加似乎具有未解决依赖性的net.sf.json库。尝试改用Android SDK JSON实现。