- 已关闭。**此问题需要debugging details。当前不接受答案。
编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
16小时前关门了。
Improve this question
我的小部件服务从WebView加载一个图像(位图),然后将其设置在小部件视图上。它主要在大多数设备上工作,但在一些设备上,我收到这个错误...
已经好几天了,我一直在挠头修改代码,但是没有任何效果...请帮帮我...怎么了
这是错误
'
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/cr_Ime: updateState: type [0->1], flags [514], show [false],
I/zygote: Background concurrent copying GC freed 100457(2MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/5MB, paused 5.675ms total 29.498ms
--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: WebpageScreenshotService
Process: com.mm.Widgets, PID: 5392
java.lang.StackOverflowError: stack size 1038KB
at java.lang.Class.isPrimitive(Unknown Source:0)
at com.google.gson.internal.$Gson$Types.checkNotPrimitive($Gson$Types.java:434)
at com.google.gson.internal.$Gson$Types.access$000($Gson$Types.java:43)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:551)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
E/AndroidRuntime: at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:553)
at com.google.gson.internal.$Gson$Types.canonicalize($Gson$Types.java:111)
E/AndroidRuntime: at com.google.gson.internal.$Gson$Types$WildcardTypeImpl.<init>($Gson$Types.java:546)
E/AndroidRuntime: at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:97)
at com.google.gson.Gson.getAdapter(Gson.java:360)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:136)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access$100(ReflectiveTypeAdapterFactory.java:49)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:106)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:105)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:161)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:97)
at com.google.gson.Gson.getAdapter(Gson.java:360)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:136)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access$100(ReflectiveTypeAdapterFactory.java:49)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:106)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:105)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:161)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:97)
at com.google.gson.Gson.getAdapter(Gson.java:360)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:136)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access$100(ReflectiveTypeAdapterFactory.java:49)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:106)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:105)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:161)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:97)
at com.google.gson.Gson.getAdapter(Gson.java:360)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:136)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access$100(ReflectiveTypeAdapterFactory.java:49)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:106)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:105)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:161)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:97)
at com.google.gson.Gson.getAdapter(Gson.java:360)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:136)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access$100(ReflectiveTypeAdapterFactory.java:49)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:106)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:105)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:161)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:97)
at com.google.gson.Gson.getAdapter(Gson.java:360)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:136)
E/AndroidRuntime: at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access$100(ReflectiveTypeAdapterFactory.java:49)
E/AndroidRuntime: at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:106)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:105)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:161)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:97)
at com.google.gson.Gson.getAdapter(Gson.java:360)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:55)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:113)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:240)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:113)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:240)
at com.google.gson.Gson.toJson(Gson.java:605)
at com.google.gson.Gson.toJson(Gson.java:584)
at com.google.gson.Gson.toJson(Gson.java:539)
at com.google.gson.Gson.toJson(Gson.java:519)
at com.orhanobut.hawk.GsonParser.toJson(GsonParser.java:26)
at com.orhanobut.hawk.HawkConverter.toString(HawkConverter.java:33)
at com.orhanobut.hawk.DefaultHawkFacade.put(DefaultHawkFacade.java:33)
at com.orhanobut.hawk.Hawk.put(Hawk.java:39)
at com.mm.Widgets.Sp_Widgets.ScreenshotService$ServiceHandler$1.onPageFinished(ScreenshotService.java:142)
at com.android.webview.chromium.WebViewContentsClientAdapter.onPageFinished(WebViewContentsClientAdapter.java:546)
at org.chromium.android_webview.AwContentsClientCallbackHelper$MyHandler.handleMessage(AwContentsClientCallbackHelper.java:201)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
'
1条答案
按热度按时间km0tfn4u1#
这是一个很长的堆栈跟踪,但是如果向下扫描足够远,就可以越过Gson并到达其他代码:
我假设
com.mm.Widgets
是您的应用。您似乎正在使用this Hawk library,这就是引发异常的原因。它使用Gson来持久化某些内容,并且对您尝试持久化的内容不满意。put()
的内容,存在Gson无法处理的特定内容,或者由于Hawk似乎没有得到积极的维护,我强烈考虑放弃Hawk。根据您尝试存储的内容,
SharedPreferences
或Jetpack DataStore可能会工作。对于大量复杂的数据,请考虑通过Room或SQLDelight使用SQLite数据库。