2
上奇怪的驗證器拒絕類我得到了一個非常奇怪的錯誤,我的android apk只有當我運行在galaxy 3 froyo設備(在仿真器和星系s2上運行良好)時纔會出現。任何想法解決onTouchEvent
錯誤來自Ontouchevent
類,如果我註釋掉某些代碼行,錯誤消失。但是這些行與這個錯誤無關(這部分代碼甚至沒有執行)。
例如,如果我添加的
if(sound)try{SoundManager.playSound(1,1);}catch(Exception e){e.printStackTrace();}
一行到的onTouchEvent KEYDOWN內部的開關的情況下,它不會引起誤差,但是如果我將它們添加(未在一次)的6,它崩潰。
我不能粘貼整個源代碼,因爲它的長,但錯誤是:
02-25 19:11:59.893: WARN/dalvikvm(5754): VFY: invalid switch start: at 88, switch offset -32758, count 33104
02-25 19:11:59.928: WARN/dalvikvm(5754): VFY: rejected Lspaceshooter/apk/OpenGLRenderer;.onTouchEvent (Landroid/view/MotionEvent;)Z
02-25 19:11:59.928: WARN/dalvikvm(5754): Verifier rejected class Lspaceshooter/apk/OpenGLRenderer;
02-25 19:11:59.928: DEBUG/AndroidRuntime(5754): Shutting down VM
02-25 19:11:59.928: WARN/dalvikvm(5754): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): FATAL EXCEPTION: main
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): java.lang.VerifyError: spaceshooter.apk.OpenGLRenderer
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at spaceshooter.apk.Main.onCreate(Main.java:84)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at android.os.Handler.dispatchMessage(Handler.java:99)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at android.os.Looper.loop(Looper.java:123)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at java.lang.reflect.Method.invokeNative(Native Method)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at java.lang.reflect.Method.invoke(Method.java:521)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
02-25 19:11:59.943: ERROR/AndroidRuntime(5754): at dalvik.system.NativeStart.main(Native Method)
任何想法?
你需要發佈一些相關的代碼 – 2012-02-25 19:49:43
我的ontouchevent類可能是「太長」?我的意思是,如果我從該類中刪除了一半的代碼,並將其粘貼到一個函數中,只需從ontouchevent調用該函數,該錯誤消失。否則所有的行都是一樣的。 – Tamas 2012-02-25 20:38:38
這是否有意義? :) – Tamas 2012-02-25 20:41:15