8-23 DAIRY

今日要点

  • 有思路写不出:知识库不充实!
  • 对自己的算法正确性太过相信,导致比暴力还low
  • 在学一个知识点的时候,多注重它可以用来解决什么问题,然后注重推导过程,因为考试时用来给你推导的而不是让你去拼命背一个程序(还背不出

考试
T1 save 20 这道题我是委屈的,其实正解思路真的就很水很好想,而且还有一个很坑的情况很多人都没考虑到,然而我(因为一些莫名其妙的原因)也知道了这个坑是什么。然而在很短的时间内想出路后却在很长的时间内停留在怎么缩点怎么tarjan判断联通etc…然后英勇的乱打了20分,真的很难受啊。所以还是要快点补充好自己的知识库!

T2 gas 0 额。?直接暴力明明有20分!然后我把20分的暴力注释掉了,交了一个自以为更优秀的式子。其实真的思路是更优秀的,但是实际操作可能还是写不过暴力那么正确吧(<-这句子不懂)0.0因为solution也提到是两边的找,emmmm,我也是分成两边,然后拆式子,预处理(在效率上稍微好那么一点点),结果不知道哪里就挂了,还不如把之前的暴力交了。(/大哭
正解的斜率优化我不是很懂…

T3 gm 5分
_ (:3JZ)_这题也是自以为是的交了一个自己想的比暴力更优秀的“暴力”。然后连最朴素最善良的真 · 暴力都没比过,还挂的这么惨。0.0这道题有一个同学有非常“优(qiao)秀(miao)”的思路。就是利用hash思想去验证两个序列的相同or相似(…是真的很巧妙啊而且还难以卡过。【要是我也能想到该多好】
改题
所以其实对今天的预期is三道题暴力都要打好,可以得60?然后如果还知识库充实可以得140?最后一题如果有那种惊人的思维可以得220?
2333333333333哇,做梦吧/笑哭
还是踏踏实实码好自己的吧。

写作业
今天写完生物作业吧就,最好再写一篇作文。【加油

心态
昨天的笔记本事件心态还是很爆炸,但是我觉得可能重新整理一些东西也是给自己一次复习的机会,所以ok吧。【sad
然后想要好好、重新列一个计划,因为最近自己的新电脑到啦!【依旧sad

--------- beginning of main --------- beginning of system 2025-06-05 19:19:52.875 2778-2778 Zygote com.example.diaryapp I seccomp disabled by setenforce 0 2025-06-05 19:19:52.876 2778-2778 xample.diaryap com.example.diaryapp I Late-enabling -Xcheck:jni 2025-06-05 19:19:52.893 2778-2778 xample.diaryap com.example.diaryapp W Unexpected CPU variant for X86 using defaults: x86_64 2025-06-05 19:19:53.227 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/os/Trace;->TRACE_TAG_APP:J (light greylist, reflection) 2025-06-05 19:19:53.227 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (light greylist, reflection) 2025-06-05 19:19:53.258 2778-2778 AppCompatDelegate com.example.diaryapp D Checking for metadata for AppLocalesMetadataHolderService : Service not found 2025-06-05 19:19:53.273 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking) 2025-06-05 19:19:53.273 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking) 2025-06-05 19:19:53.273 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking) 2025-06-05 19:19:53.273 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking) 2025-06-05 19:19:53.293 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection) 2025-06-05 19:19:53.294 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection) 2025-06-05 19:19:53.298 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/graphics/FontFamily;-><init>()V (light greylist, reflection) 2025-06-05 19:19:53.298 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/graphics/FontFamily;->addFontFromAssetManager(Landroid/content/res/AssetManager;Ljava/lang/String;IZIII[Landroid/graphics/fonts/FontVariationAxis;)Z (light greylist, reflection) 2025-06-05 19:19:53.298 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/graphics/FontFamily;->addFontFromBuffer(Ljava/nio/ByteBuffer;I[Landroid/graphics/fonts/FontVariationAxis;II)Z (light greylist, reflection) 2025-06-05 19:19:53.298 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/graphics/FontFamily;->freeze()Z (light greylist, reflection) 2025-06-05 19:19:53.298 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/graphics/FontFamily;->abortCreation()V (light greylist, reflection) 2025-06-05 19:19:53.299 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/graphics/Typeface;->createFromFamiliesWithDefault([Landroid/graphics/FontFamily;Ljava/lang/String;II)Landroid/graphics/Typeface; (light greylist, reflection) 2025-06-05 19:19:53.400 2778-2778 OpenGLRenderer com.example.diaryapp D Skia GL Pipeline 2025-06-05 19:19:53.417 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/view/WindowInsets;->CONSUMED:Landroid/view/WindowInsets; (light greylist, reflection) 2025-06-05 19:19:53.417 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/view/View;->getViewRootImpl()Landroid/view/ViewRootImpl; (light greylist, reflection) 2025-06-05 19:19:53.417 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/view/View$AttachInfo;->mVisibleInsets:Landroid/graphics/Rect; (light greylist, reflection) 2025-06-05 19:19:53.417 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/view/ViewRootImpl;->mAttachInfo:Landroid/view/View$AttachInfo; (light greylist, reflection) 2025-06-05 19:19:53.429 2778-2820 <no-tag> com.example.diaryapp D HostConnection::get() New Host Connection established 0x7f2e2dac31c0, tid 2820 2025-06-05 19:19:53.429 2778-2820 <no-tag> com.example.diaryapp W Process pipe failed 2025-06-05 19:19:53.431 2778-2820 ConfigStore com.example.diaryapp I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 2025-06-05 19:19:53.431 2778-2820 ConfigStore com.example.diaryapp I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0 2025-06-05 19:19:53.431 2778-2820 OpenGLRenderer com.example.diaryapp I Initialized EGL, version 1.4 2025-06-05 19:19:53.431 2778-2820 OpenGLRenderer com.example.diaryapp D Swap behavior 1 2025-06-05 19:19:53.432 2778-2820 EGL_adreno com.example.diaryapp E CreateContext rcMajorVersion:3, minorVersion:2 2025-06-05 19:19:53.440 2778-2820 EGL_adreno com.example.diaryapp D eglCreateContext: 0x7f2e2da45b20: maj 3 min 2 rcv 3 2025-06-05 19:19:53.440 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:19:53.440 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:19:53.472 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:19:53.472 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:19:53.473 2778-2820 vndksupport com.example.diaryapp D Loading /vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace. 2025-06-05 19:19:53.473 2778-2820 vndksupport com.example.diaryapp D Loading /vendor/lib64/hw/gralloc.gmin.so from current namespace instead of sphal namespace. 2025-06-05 19:19:53.476 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:19:53.476 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2db09100, error=EGL_BAD_MATCH 2025-06-05 19:19:53.902 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (light greylist, reflection) 2025-06-05 19:19:53.902 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (light greylist, reflection) 2025-06-05 19:19:53.902 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden method Landroid/os/Trace;->traceCounter(JLjava/lang/String;I)V (light greylist, reflection) 2025-06-05 19:19:58.602 2778-2845 ProfileInstaller com.example.diaryapp D Installing profile for com.example.diaryapp 2025-06-05 19:22:51.307 2778-2778 Choreographer com.example.diaryapp I Skipped 32 frames! The application may be doing too much work on its main thread. 2025-06-05 19:22:51.377 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:22:51.377 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:22:51.401 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:22:51.401 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2a73b480, error=EGL_BAD_MATCH 2025-06-05 19:22:52.875 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:22:52.875 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:22:52.879 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@b70dda7 2025-06-05 19:22:52.882 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:22:52.882 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2db09880, error=EGL_BAD_MATCH 2025-06-05 19:22:53.180 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:22:53.180 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:22:53.197 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:22:53.197 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2a73b480, error=EGL_BAD_MATCH 2025-06-05 19:22:53.203 2778-2778 Glide com.example.diaryapp W Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored 2025-06-05 19:22:59.515 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@dee6c34 2025-06-05 19:22:59.547 2778-2783 xample.diaryap com.example.diaryapp I Compiler allocated 4MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int) 2025-06-05 19:22:59.572 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:22:59.572 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:22:59.586 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:22:59.586 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2db09b80, error=EGL_BAD_MATCH 2025-06-05 19:23:07.999 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:23:07.999 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:23:08.013 2778-2778 xample.diaryap com.example.diaryapp W Accessing hidden field Landroid/view/View;->mAccessibilityDelegate:Landroid/view/View$AccessibilityDelegate; (light greylist, reflection) 2025-06-05 19:23:08.015 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:23:08.015 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2a73b280, error=EGL_BAD_MATCH 2025-06-05 19:23:10.088 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@a431ad9 2025-06-05 19:23:10.141 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:23:10.141 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:23:10.160 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:23:10.160 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2da27800, error=EGL_BAD_MATCH 2025-06-05 19:23:18.089 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:23:18.089 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:23:18.109 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:23:18.109 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2a736700, error=EGL_BAD_MATCH 2025-06-05 19:23:20.289 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@6e93288 2025-06-05 19:23:20.343 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:23:20.343 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:23:20.364 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:23:20.364 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d387d00, error=EGL_BAD_MATCH 2025-06-05 19:23:22.178 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:23:22.178 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:23:22.188 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:23:22.188 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d5bf900, error=EGL_BAD_MATCH 2025-06-05 19:23:26.082 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:23:26.082 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:23:26.102 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:23:26.102 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d5bf900, error=EGL_BAD_MATCH 2025-06-05 19:27:41.046 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@4c87c69 2025-06-05 19:27:41.111 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:27:41.111 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:27:41.124 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:27:41.124 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d4afd00, error=EGL_BAD_MATCH 2025-06-05 19:27:42.651 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:27:42.651 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:27:42.667 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:27:42.667 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e1d4af080, error=EGL_BAD_MATCH 2025-06-05 19:27:42.732 2778-2789 System com.example.diaryapp W A resource failed to call close. 2025-06-05 19:27:42.732 2778-2789 chatty com.example.diaryapp I uid=10062(com.example.diaryapp) FinalizerDaemon identical 1 line 2025-06-05 19:27:42.734 2778-2789 System com.example.diaryapp W A resource failed to call close. 2025-06-05 19:27:44.377 2778-2820 OpenGLRenderer com.example.diaryapp D endAllActiveAnimators on 0x7f2e1623df00 (RippleDrawable) with handle 0x7f2e2dab3800 2025-06-05 19:27:44.393 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:27:44.393 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:27:44.416 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:27:44.416 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e16286180, error=EGL_BAD_MATCH 2025-06-05 19:27:48.098 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@845b71b 2025-06-05 19:27:48.195 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:27:48.195 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:27:48.203 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:27:48.203 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2a73b500, error=EGL_BAD_MATCH 2025-06-05 19:27:49.264 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@a6acb9a 2025-06-05 19:27:49.389 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:27:49.389 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:27:49.397 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:27:49.397 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e16286e00, error=EGL_BAD_MATCH 2025-06-05 19:28:07.132 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@e46c675 2025-06-05 19:28:07.237 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:28:07.237 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:28:07.262 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:28:07.262 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e16286e00, error=EGL_BAD_MATCH 2025-06-05 19:28:08.766 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:28:08.766 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:28:08.772 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@8487834 2025-06-05 19:28:08.777 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:28:08.777 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e162dca00, error=EGL_BAD_MATCH 2025-06-05 19:28:08.811 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:28:08.811 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:28:08.829 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:28:08.829 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2db8d000, error=EGL_BAD_MATCH 2025-06-05 19:28:11.031 2778-2778 ActivityThread com.example.diaryapp W handleWindowVisibility: no activity for token android.os.BinderProxy@4a13060 2025-06-05 19:28:11.094 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:28:11.094 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:28:11.115 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:28:11.115 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e16430500, error=EGL_BAD_MATCH 2025-06-05 19:28:12.651 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:28:12.651 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:28:12.671 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:28:12.671 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e162dc500, error=EGL_BAD_MATCH 2025-06-05 19:28:14.160 2778-2820 OpenGLRenderer com.example.diaryapp D endAllActiveAnimators on 0x7f2e165b7b00 (RippleDrawable) with handle 0x7f2e2db3c200 2025-06-05 19:28:14.178 2778-2820 EGL_adreno com.example.diaryapp E [getAttribValue] Bad attribute idx 2025-06-05 19:28:14.178 2778-2820 EGL_adreno com.example.diaryapp D eglGetConfigAttrib: bad attrib 0x3339 2025-06-05 19:28:14.197 2778-2820 EGL_adreno com.example.diaryapp E tid 2820: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH) 2025-06-05 19:28:14.197 2778-2820 OpenGLRenderer com.example.diaryapp W Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f2e2db8d180, error=EGL_BAD_MATCH
最新发布
06-06
<think>我们正在分析一个Android应用的日志,日志中出现了多个警告和错误。主要问题集中在以下几个方面:1.大量的“Accessinghiddenfield/method”警告,这是由于使用了反射访问了系统隐藏API。2.OpenGL渲染相关的错误:EGL_BAD_MATCH,以及设置EGL_SWAP_BEHAVIOR失败。3.主线程跳过32帧,可能由于主线程做了太多工作。4.Glide警告:FailedtofindGeneratedAppGlideModule。5.资源关闭失败警告:Aresourcefailedtocallclose。我们将逐一分析并给出解决方案。###问题1:隐藏API的访问(反射警告)日志中多次出现类似这样的警告:```WAccessinghiddenfieldLandroid/graphics/Insets;->left:I(lightgreylist,linking)WAccessinghiddenmethodLandroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z(lightgreylist,reflection)```这些警告表示应用通过反射访问了AndroidSDK中的隐藏API。从Android9(API级别28)开始,Google限制了非公开API的使用。**解决方案**:1.避免使用反射访问隐藏API,因为这些API可能在未来的Android版本中被移除或更改。2.如果必须使用,可以考虑使用公共API替代。例如,对于Insets,可以使用`WindowInsetsCompat`(来自AndroidX库)来替代。3.如果无法避免,并且这些API在应用的目标API级别中处于greylist(即lightgreylist),那么目前还可以使用,但需要注意未来版本的限制。但是,在Android10(API29)及更高版本中,对非SDK接口的限制更加严格。因此,建议尽量移除这些反射调用。###问题2:OpenGL渲染错误(EGL_BAD_MATCH)频繁出现以下错误:```Etid2820:eglSurfaceAttrib(1615):error0x3009(EGL_BAD_MATCH)WFailedtosetEGL_SWAP_BEHAVIORonsurface0x7f2e2db09100,error=EGL_BAD_MATCH```这个错误通常发生在尝试设置一个不被支持的Surface属性。在这里,我们试图设置`EGL_SWAP_BEHAVIOR`属性,但是当前配置不支持。**解决方案**:1.检查设置`EGL_SWAP_BEHAVIOR`的代码。在OpenGLES中,通常我们会在创建EGLSurface时设置属性,但某些设备可能不支持特定的属性。2.避免设置`EGL_SWAP_BEHAVIOR`,因为这不是必需的。我们可以忽略这个错误,因为根据EGL规范,这个属性是可选支持(EGL1.4规范中,它是EGL扩展EGL_KHR_swap_behavior的一部分,并非所有设备都支持)。3.在创建EGLConfig时,检查是否支持该属性。我们可以通过`eglGetConfigAttrib`来检查`EGL_SWAP_BEHAVIOR`是否在配置中支持。但是,由于这些日志来自系统渲染器(OpenGLRenderer),并不是我们直接调用的,所以可能是系统内部的问题。我们可以尝试以下措施:-确保我们的应用没有使用不支持的硬件加速特性。-更新设备图形驱动(如果可能)。-忽略这个错误,因为它可能不会影响应用的功能。###问题3:主线程负载过重日志出现:```ISkipped32frames!Theapplicationmaybedoingtoomuchworkonitsmainthread.```这表明在主线程上执行了太多任务,导致UI渲染跟不上。**解决方案**:1.将耗时操作(如网络请求、数据库读写、复杂计算)移出主线程,使用异步任务(AsyncTask)、线程池、协程(Kotlin)或WorkManager等。2.使用性能分析工具(如AndroidProfiler)找出卡顿原因。3.优化布局,减少布局层次和复杂性。4.使用RecyclerView替代ListView,避免在onDraw方法中执行复杂操作。###问题4:Glide警告```WFailedtofindGeneratedAppGlideModule.YoushouldincludeanannotationProcessorcompiledependencyoncom.github.bumptech.glide:compilerinyourapplicationanda@GlideModuleannotatedAppGlideModuleimplementationorLibraryGlideModuleswillbesilentlyignored```这个警告表示我们使用了Glide库,但没有配置Glide的注解处理器和AppGlideModule。**解决方案**:1.添加Glide的注解处理器依赖(在app模块的build.gradle中):```groovydependencies{implementation'com.github.bumptech.glide:glide:4.12.0'annotationProcessor'com.github.bumptech.glide:compiler:4.12.0'}```2.创建一个自定义的AppGlideModule:```java@GlideModulepublicclassMyAppGlideModuleextendsAppGlideModule{//可以留空,用于生成必要的代码}```###问题5:资源关闭失败```WAresourcefailedtocallclose.```这个警告表示某个资源(如文件流、数据库连接等)在垃圾回收时没有正确关闭。**解决方案**:确保在使用完资源(如Cursor、InputStream等)后,在finally块中显式关闭它们。例如,在使用Cursor时:```javaCursorcursor=null;try{cursor=db.query(...);//处理cursor}finally{if(cursor!=null){cursor.close();}}```或者在try-with-resources(需要API级别18及以上):```javatry(Cursorcursor=db.query(...)){//处理cursor}```##总结我们针对日志中的问题提出了解决方案。由于日志主要是警告和错误,可能不会导致应用崩溃,但会影响性能和稳定性。特别是主线程负载过重的问题,需要重点优化。如果问题仍然存在,建议使用更详细的日志和性能分析工具进行深入排查。§§相关问题§§:1.在Android中如何正确使用反射以避免访问受限制的非SDKAPI?2.如何检测和优化Android应用的主线程性能?3.如何处理Android中OpenGLES的EGL错误?4.Glide库中`AppGlideModule`的作用是什么?</think> ### 问题分析 日志显示你的Android日记应用存在多个关键问题: 1. **主线程性能瓶颈**: ```log Choreographer com.example.diaryapp I Skipped 32 frames! The application may be doing too much work on its main thread. ``` 主线程执行过多任务导致UI渲染延迟32帧 2. **OpenGL渲染问题**: ```log EGL_adreno [getAttribValue] Bad attribute idx Failed to set EGL_SWAP_BEHAVIOR on surface... error=EGL_BAD_MATCH ``` EGL_BAD_MATCH错误连续出现,严重影响界面渲染 3. **资源管理问题**: ```log System W A resource failed to call close ``` 资源未能正确关闭导致内存泄漏 4. **Glide配置缺失**: ```log Glide W Failed to find GeneratedAppGlideModule ``` 图片加载库未正确配置 --- ### 解决方案 #### 1. 主线程优化 (解决UI卡顿) ```java // 在数据库访问处使用AsyncTask public class DiaryQueryTask extends AsyncTask<Integer, Void, List<Diary>> { private WeakReference<Context> contextRef; private DatabaseHelper dbHelper; public DiaryQueryTask(Context context) { this.contextRef = new WeakReference<>(context); this.dbHelper = new DatabaseHelper(context); } @Override protected List<Diary> doInBackground(Integer... userIds) { return dbHelper.getDiariesByUserId(userIds[0]); } @Override protected void onPostExecute(List<Diary> diaries) { Context context = contextRef.get(); if (context != null && context instanceof DiaryListActivity) { ((DiaryListActivity) context).updateDiaryList(diaries); } dbHelper.close(); } } // 在Activity中调用 new DiaryQueryTask(this).execute(userId); ``` **优化说明**: - 使用`AsyncTask`将数据库操作移至后台线程 - `WeakReference`防止内存泄漏 - 确保在后台线程中关闭数据库连接 - 主线程仅处理UI更新 #### 2. OpenGL渲染修复 ```xml <!-- 在AndroidManifest.xml中添加 --> <application android:hardwareAccelerated="true" android:largeHeap="true"> <activity android:name=".MainActivity" android:hardwareAccelerated="false"> <!-- 对问题Activity禁用硬件加速 --> </activity> </application> ``` ```java // 在自定义View中修复渲染代码 public class DiaryRenderView extends GLSurfaceView { public DiaryRenderView(Context context) { super(context); setEGLContextClientVersion(2); setRenderer(new DiaryRenderer()); setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); // 仅在需要时渲染 } private static class DiaryRenderer implements GLSurfaceView.Renderer { @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { // 设置合理的默认值 gl.glClearColor(0f, 0f, 0f, 1f); gl.glDisable(GL10.GL_DITHER); } @Override public void onSurfaceChanged(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); } @Override public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // 简化渲染逻辑 } } } ``` **优化说明**: - 禁用问题Activity的硬件加速 - 使用`RENDERMODE_WHEN_DIRTY`减少不必要的渲染 - 简化OpenGL渲染逻辑 - 设置合理的默认值避免兼容性问题 #### 3. Glide配置修复 ```java // 添加Glide模块配置 @GlideModule public class DiaryGlideModule extends AppGlideModule { @Override public void applyOptions(Context context, GlideBuilder builder) { builder.setDefaultRequestOptions( new RequestOptions() .format(DecodeFormat.PREFER_RGB_565) // 减少内存占用 .disallowHardwareConfig() // 避免OpenGL问题 ); } } ``` ```gradle // 在app/build.gradle中添加依赖 dependencies { implementation 'com.github.bumptech.glide:glide:4.12.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' } ``` #### 4. 资源泄露修复 ```java public class SafeResourceUtils { public static void closeQuietly(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (IOException e) { Log.e("Resource", "Close failed", e); } } } public static void closeCursor(Cursor cursor) { if (cursor != null && !cursor.isClosed()) { cursor.close(); } } } // 在数据库操作中使用 Cursor cursor = null; try { cursor = db.query(...); // 处理数据 } finally { SafeResourceUtils.closeCursor(cursor); } ``` --- ### 性能优化建议 1. **启用StrictMode检测**(开发阶段): ```java public void enableStrictMode() { if (BuildConfig.DEBUG) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() .detectNetwork() .penaltyLog() .build()); } } ``` 2. **使用内存分析工具**: ```bash # 在终端运行 adb shell dumpsys meminfo com.example.diaryapp ``` 3. **优化图片处理**: ```java // Glide加载时添加内存优化 GlideApp.with(context) .load(imagePath) .override(800, 600) // 限制分辨率 .format(DecodeFormat.PREFER_RGB_565) .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC) .into(imageView); ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值