我正在尝试创建一个签名的 android apk 文件,这很好用。我在我的手机(Android 2.2)上安装了该文件,但是当我打开应用程序时,我在我的 Logcat 中得到了这个堆栈跟踪:
08-23 13:58:55.271: E/AndroidRuntime(3643): FATAL EXCEPTION: main
08-23 13:58:55.271: E/AndroidRuntime(3643): java.lang.RuntimeException: Unable to create application net.osmand.activities.OsmandApplication: java.lang.UnsupportedOperationException: java.lang.NoSuchMethodException: values
08-23 13:58:55.271: E/AndroidRuntime(3643): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4247)
08-23 13:58:55.271: E/AndroidRuntime(3643): at android.app.ActivityThread.access$3000(ActivityThread.java:125)
08-23 13:58:55.271: E/AndroidRuntime(3643): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
08-23 13:58:55.271: E/AndroidRuntime(3643): at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 13:58:55.271: E/AndroidRuntime(3643): at android.os.Looper.loop(Looper.java:123)
08-23 13:58:55.271: E/AndroidRuntime(3643): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-23 13:58:55.271: E/AndroidRuntime(3643): at java.lang.reflect.Method.invokeNative(Native Method)
08-23 13:58:55.271: E/AndroidRuntime(3643): at java.lang.reflect.Method.invoke(Method.java:521)
08-23 13:58:55.271: E/AndroidRuntime(3643): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
08-23 13:58:55.271: E/AndroidRuntime(3643): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
08-23 13:58:55.271: E/AndroidRuntime(3643): at dalvik.system.NativeStart.main(Native Method)
08-23 13:58:55.271: E/AndroidRuntime(3643): Caused by: java.lang.UnsupportedOperationException: java.lang.NoSuchMethodException: values
08-23 13:58:55.271: E/AndroidRuntime(3643): at java.lang.ClassCache.callEnumValues(ClassCache.java:637)
08-23 13:58:55.271: E/AndroidRuntime(3643): at java.lang.ClassCache.getEnumValuesInOrder(ClassCache.java:613)
08-23 13:58:55.271: E/AndroidRuntime(3643): at java.lang.ClassCache.getEnumValuesByName(ClassCache.java:587)
08-23 13:58:55.271: E/AndroidRuntime(3643): at java.lang.ClassCache.getEnumValue(ClassCache.java:546)
08-23 13:58:55.271: E/AndroidRuntime(3643): at java.lang.Enum.valueOf(Enum.java:177)
08-23 13:58:55.271: E/AndroidRuntime(3643): at aA.a(Unknown Source)
08-23 13:58:55.271: E/AndroidRuntime(3643): at az.i(Unknown Source)
08-23 13:58:55.271: E/AndroidRuntime(3643): at net.osmand.activities.OsmandApplication.onCreate(Unknown Source)
08-23 13:58:55.271: E/AndroidRuntime(3643): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
08-23 13:58:55.271: E/AndroidRuntime(3643): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4244)
08-23 13:58:55.271: E/AndroidRuntime(3643): ... 10 more
08-23 13:58:55.271: E/AndroidRuntime(3643): Caused by: java.lang.NoSuchMethodException: values
08-23 13:58:55.271: E/AndroidRuntime(3643): at java.lang.ClassCache.findMethodByName(ClassCache.java:308)
08-23 13:58:55.271: E/AndroidRuntime(3643): at java.lang.ClassCache.callEnumValues(ClassCache.java:633)
08-23 13:58:55.271: E/AndroidRuntime(3643): ... 19 more
当我在我的设备上从 Eclipse 运行 apk 时,它运行良好。还将apk发送给朋友,他的apk也运行良好(通过eclipse构建bin目录中的on)。
谁能指出我正确的方向?我相信我可能会丢失一些库,但我会觉得这很奇怪,因为从 Eclipse 运行它时它工作正常。但就像我说的我是菜鸟!