All- I have an app that works fine on my actual device (Android 4.0.4) and on most of my emulators (2.3.3, 3.0, 3.1, 3.2, 4.0, 4.0.3, etc.). When I try to change from activity A to activity B via an onClick method, on my 2.2 emulator it force closes. I am getting this in the logcat:
07-16 01:01:10.487: E/AndroidRuntime(277): FATAL EXCEPTION: main
07-16 01:01:10.487: E/AndroidRuntime(277): java.lang.VerifyError: flatirons.applications.monopoly.Properties
07-16 01:01:10.487: E/AndroidRuntime(277): at java.lang.Class.newInstanceImpl(Native Method)
07-16 01:01:10.487: E/AndroidRuntime(277): at java.lang.Class.newInstance(Class.java:1429)
07-16 01:01:10.487: E/AndroidRuntime(277): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-16 01:01:10.487: E/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
07-16 01:01:10.487: E/AndroidRuntime(277): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-16 01:01:10.487: E/AndroidRuntime(277): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-16 01:01:10.487: E/AndroidRuntime(277): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-16 01:01:10.487: E/AndroidRuntime(277): at android.os.Handler.dispatchMessage(Handler.java:99)
07-16 01:01:10.487: E/AndroidRuntime(277): at android.os.Looper.loop(Looper.java:123)
07-16 01:01:10.487: E/AndroidRuntime(277): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-16 01:01:10.487: E/AndroidRuntime(277): at java.lang.reflect.Method.invokeNative(Native Method)
07-16 01:01:10.487: E/AndroidRuntime(277): at java.lang.reflect.Method.invoke(Method.java:521)
07-16 01:01:10.487: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-16 01:01:10.487: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-16 01:01:10.487: E/AndroidRuntime(277): at dalvik.system.NativeStart.main(Native Method)
I did a little research and found out that the cause of java.lang.VerifyError
is because of a lack of features that are not support in that API (ie. using NFC in android 1.6), or using an non-compatible external library. I am not using an external library so I figured I must be using advanced features that are only available in android 2.3.3+. I went to the problem lines, ie 1429, and found this spinner1.getSelectedItem().toString();
. I than went to the android website and found that this method has existed since API 1. Other features app has include:
spinners, buttons, 4 activities, edittext, textview, and a menu. QUESTION: What could be causing java.lang.VerifyError
other than non-compatible external libraries and android features? I will post code from specific lines as you ask for them. Thanks for your time!