youlookwhat / CloudReader

🗡️ 云阅:一款基于网易云音乐UI,使用玩Android Api,Retrofit2 + RxJava2 + Room + MVVM-databinding架构开发的Android客户端
https://youlookwhat.github.io/CloudReader
Apache License 2.0
4.94k stars 1.33k forks source link

首页进来,logcat提醒“[ANR Warning]onMeasure time too long...” #121

Closed Bobyang912 closed 4 years ago

Bobyang912 commented 4 years ago

activity_base+activity_main+fragment_base+fragment_content...会不会嵌套太深了? 2020-06-20 08:28:55.104 21900-21900/com.example.jingbin.cloudreader I/Choreographer: Skipped 77 frames! The application may be doing too much work on its main thread. 2020-06-20 08:28:55.113 21900-22100/com.example.jingbin.cloudreader I/OpenGLRenderer: Davey! duration=1290ms; Flags=0, IntendedVsync=3128724567526412, Vsync=3128725844051585, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=3128725848896408, AnimationStart=3128725849020561, PerformTraversalsStart=3128725849584177, DrawStart=3128725850778100, SyncQueued=3128725850902331, SyncStart=3128725850931484, IssueDrawCommandsStart=3128725850962177, SwapBuffers=3128725856399408, FrameCompleted=3128725857651023, DequeueBufferDuration=2659000, QueueBufferDuration=570000, 2020-06-20 08:28:55.744 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =android.support.v4.view.ViewPager{b4641ac VFED..... ......I. 0,0-0,0 #7f0801fa app:id/vp_content}time =600 ms 2020-06-20 08:28:55.744 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =android.widget.LinearLayout{bf48e75 V.E...... ......I. 0,0-0,0 #7f0800a5 app:id/include}time =603 ms 2020-06-20 08:28:55.745 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =android.support.v4.widget.DrawerLayout{e067e0a VFED..... ......I. 0,0-0,0 #7f08006d app:id/drawer_layout}time =605 ms 2020-06-20 08:28:55.796 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =android.widget.RelativeLayout{8e6e67b V.E...... ......I. 0,0-0,0 #7f080054 app:id/container}time =655 ms 2020-06-20 08:28:55.796 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =android.widget.LinearLayout{2abcc98 V.E...... ......I. 0,0-0,0 #7f0800f5 app:id/ll_root}time =656 ms 2020-06-20 08:28:55.796 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =android.support.v7.widget.ContentFrameLayout{10c9cf1 V.E...... ......I. 0,0-0,0 #1020002 android:id/content}time =657 ms 2020-06-20 08:28:55.796 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =android.support.v7.widget.FitWindowsLinearLayout{d9670d6 V.E...... ......I. 0,0-0,0 #7f08000a app:id/action_bar_root}time =657 ms 2020-06-20 08:28:55.797 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =android.widget.FrameLayout{af36f57 V.E...... ......I. 0,0-0,0}time =657 ms 2020-06-20 08:28:55.797 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =android.widget.LinearLayout{9dd1a44 V.E...... ......I. 0,0-0,0}time =658 ms 2020-06-20 08:28:55.797 21900-21900/com.example.jingbin.cloudreader D/View: [ANR Warning]onMeasure time too long, this =DecorView@8b5dc51[MainActivity]time =658 ms 2020-06-20 08:28:55.809 21900-21900/com.example.jingbin.cloudreader D/Surface: Surface::allocateBuffers(this=0xcb5e8000) 2020-06-20 08:28:55.809 21900-22100/com.example.jingbin.cloudreader D/Surface: Surface::connect(this=0xcb5e8000,api=1) 2020-06-20 08:28:55.819 21900-22100/com.example.jingbin.cloudreader D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000 2020-06-20 08:28:56.028 21900-21900/com.example.jingbin.cloudreader I/Choreographer: Skipped 53 frames! The application may be doing too much work on its main thread. 2020-06-20 08:28:56.141 21900-22100/com.example.jingbin.cloudreader I/OpenGLRenderer: Davey! duration=994ms; Flags=1, IntendedVsync=3128725891200372, Vsync=3128726769847569, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=3128726772792408, AnimationStart=3128726772969177, PerformTraversalsStart=3128726773222100, DrawStart=3128726794010331, SyncQueued=3128726816846485, SyncStart=3128726816985331, IssueDrawCommandsStart=3128726817149100, SwapBuffers=3128726884293946, FrameCompleted=3128726885809023, DequeueBufferDuration=5218000, QueueBufferDuration=773000, 2020-06-20 08:28:56.143 21900-22100/com.example.jingbin.cloudreader D/Surface: Surface::disconnect(this=0xe7f66000,api=1) 2020-06-20 08:28:56.180 21900-21900/com.example.jingbin.cloudreader I/Choreographer: Skipped 7 frames! The application may be doing too much work on its main thread.

youlookwhat commented 4 years ago

使用这样的结构是嵌套比较深,这种结构 布局优化也差不多就这样了,如果想要改变这种情况建议你更换布局结构吧,不要使用项目中这种嵌套结构。