{"id":4913,"date":"2024-10-06T17:01:01","date_gmt":"2024-10-06T09:01:01","guid":{"rendered":""},"modified":"2024-10-06T17:01:01","modified_gmt":"2024-10-06T09:01:01","slug":"java.lang.reflect.undeclared_\u6211\u7684\u4e16\u754c\u65e0\u6cd5\u542f\u52a8java","status":"publish","type":"post","link":"https:\/\/mushiming.com\/4913.html","title":{"rendered":"java.lang.reflect.undeclared_\u6211\u7684\u4e16\u754c\u65e0\u6cd5\u542f\u52a8java"},"content":{"rendered":"

\u5728\u8c03\u8bd5SharedPreferences\u7684\u4ee3\u7801\u4e2d\uff0c\u6709\u65f6\u5019\u4f1a\u5c06\u539f\u5148\u5b58\u50a8\u7684string\u7c7b\u578b\u8f6c\u6362\u6210\u5176\u4ed6\u7c7b\u578b\uff0c\u8fd9\u4e2a\u65f6\u5019\u5c31\u4f1a\u62a5\u9519\uff1a<\/span><\/p>\n

<\/span><\/p>\n

 STACK_TRACE=java.lang.RuntimeException: Unable to resume activity {com.kingnet.gamecenter\/com.kingnet.gamecenter.activity.SettingActivity}: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2790) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2819) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2266) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean at android.app.SharedPreferencesImpl.getBoolean(SharedPreferencesImpl.java:261) at com.kingnet.gamecenter.store.SharedStore.getBoolean(SharedStore.java:178)<\/code><\/pre>\n

\u8fd9\u4e2a\u65f6\u5019\u5e94\u8be5\u5378\u8f7d\u6389\u4f60\u7684\u7a0b\u5e8f\uff0c\u7136\u540e\u91cd\u65b0\u8fd0\u884c\u5c31\u53ef\u4ee5\u4e86\u3002 <\/p>\n

\u539f\u56e0\uff1a<\/span><\/p>\n

\u8c03\u8bd5\u7a0b\u5e8f\u7684\u65f6\u5019\uff0c\u7a0b\u5e8f\u4ec5\u4ec5\u662f\u91cd\u590d\u5b89\u88c5\uff0c\u6ca1\u6709\u6e05\u7a7a\u7a0b\u5e8f\u539f\u5148\u7684\u5b58\u50a8\uff0c\u5c31\u662f\u8bf4SharedPreferences \u91cc\u9762\u5b58\u50a8\u7684\u8fd8\u662f\u4f60\u539f\u6765\u7684\u503c\uff0c\u73b0\u5728\u4f60\u8981\u4fee\u6539\u4e3a\u65b0\u7684\u7c7b\u578b\uff0c\u8fd9\u6837\u5c31\u51fa\u73b0\u4e86\u8fd9\u4e2a\u5f02\u5e38<\/p>\n

<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"java.lang.reflect.undeclared_\u6211\u7684\u4e16\u754c\u65e0\u6cd5\u542f\u52a8java\u5728\u8c03\u8bd5SharedPreferences\u7684\u4ee3\u7801\u4e2d\uff0c\u6709\u65f6\u5019\u4f1a\u5c06\u539f\u5148\u5b58\u50a8\u7684string\u7c7b\u578b\u8f6c\u6362...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/4913"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=4913"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/4913\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=4913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=4913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=4913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}