我正在尝试将 JTwitter 集成到一个 Android 应用程序中,并且在我决定对旧 Android 版本进行回归测试之前,我已经完全成功了。在 Android 2.x 中,我的代码运行良好,但在 Android 1.5/1.6 中,Dalvik 在以下行抛出了一个 VerifyError:
OAuthSignpostClient oauthClient
= new OAuthSignpostClient(KEY_TWITTER, SECRET_TWITTER, "oob");
并提供此 logcat 输出和堆栈跟踪:
Could not find method javax.swing.JOptionPane.showInputDialog, referenced from method winterwell.jtwitter.OAuthSignpostClient.askUser
VFY: unable to resolve static method 1703: Ljavax/swing/JOptionPane;.showInputDialog (Ljava/lang/Object;)Ljava/lang/String;
VFY: rejecting opcode 0x71 at 0x0000
VFY: rejected Lwinterwell/jtwitter/OAuthSignpostClient;.askUser (Ljava/lang/String;)Ljava/lang/String;
Verifier rejected class Lwinterwell/jtwitter/OAuthSignpostClient;
Shutting down VM
threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
Uncaught handler: thread main exiting due to uncaught exception
java.lang.VerifyError: winterwell.jtwitter.OAuthSignpostClient
at com.wirelessdesigns.android.AuthActivity.onCreate(AuthActivity.java:37)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
at android.app.ActivityThread.access$2100(ActivityThread.java:116)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
at dalvik.system.NativeStart.main(Native Method)
我试图弄清楚会影响这一点的Android版本之间的底层实现可能发生了什么变化以及解决方法可能是什么? 不久前回答了一个类似的问题,但答案是以论坛帖子的现已死链接的形式出现的。
有什么想法吗?