随笔分类 - Android 性能优化
摘要:1.应用场景 1.1 简介 应用中经常有一张图片和文字同时出现的情况,如下: 可以使用一个ImageView + 1个TextView 实现, 也可以用一个TextView+它的 drawableLeft、drawableRight、drawableTop、drawableBottom、drawab
阅读全文
摘要:1.官方文档 https://developer.android.com/studio/build/multidex 主要内容: 什么是64K限制 编码时如何避免64K 限制 拆分dex避免64K 限制 2.DEX DEX = Dalvik Executable , android Dalvik j
阅读全文
摘要:1.Thread.UncaughtExceptionHandler java里有很多异常如:空指针异常,越界异常,数值转换异常,除0异常,数据库异常等等。如果自己没有try / catch 那么线程就崩溃。 并不能对所有代码都try/catch,如果代码产生了未捕获的异常,又不想让程序崩溃,或者在崩
阅读全文
摘要:1.Instant Run 简介 官网: https://developer.android.com/studio/run/index.html#instant-run Android Studio 2.0 中引入的 Instant Run,方便快速调试应用. 无需构建新的 APK 即可推送新的更改
阅读全文
摘要:1.Java内存回收机制 不论哪种语言的内存分配方式,都需要返回所分配内存的真实地址,也就是返回一个指针到内存块的首地址。Java中对象是采用new或者反射的方法创建的,这些对象的创建都是在堆(Heap)中分配的,所有对象的回收都是由Java虚拟机通过垃圾回收机制完成的。GC为了能够正确释放对象,会
阅读全文
摘要:1.zipalign 简介 zipalign is an archive alignment tool that provides important optimization to Android application (.apk) files. The purpose is to ensure
阅读全文
摘要:Batterystats & Battery Historian Walkthrough Working with Batterystats & Battery Historian Battery Historian Charts You should also read Battery Histo
阅读全文
摘要:1.官方文档 https://developer.android.google.cn/topic/performance/tracing https://ui.perfetto.dev/ 在线阅读trace文件 https://perfetto.dev/ perfetto 官方 2.命令行上捕获系统
阅读全文
摘要:Profiling with Traceview and dmtracedump In this document Traceview Layout Traceview工具界面介绍 Timeline Panel 时间线面板 Profile Panel 数据面板 各行列介绍 Creating Trac
阅读全文
摘要:Memory Profilers In this document Memory Monitor Heap Viewer Allocation Tracker You should also read Memory Monitor Walkthrough Heap Viewer Walkthroug
阅读全文
摘要:Hierarchy Viewer Walkthrough 1.In this document Prerequisites Setting the ANDROID_HVPROTO variable Working with Hierarchy Viewer You should also read
阅读全文
摘要:Profiling GPU Rendering Walkthrough 1.In this document Prerequisites Profile GPU Rendering $adb shell dumpsys gfxinfo You should also read Debug GPU O
阅读全文
摘要:SMP Primer for Android 1.In this document Theory Memory consistency models Processor consistency CPU cache behavior Observability ARM’s weak ordering
阅读全文
摘要:Performance Tips 1.In this document Avoid Creating Unnecessary Objects 避免多余的对象 Prefer Static Over Virtual 多用static方法,它比其它方法快15%-20% Use Static Final F
阅读全文
摘要:JNI Tips 1.In this document JavaVM and JNIEnv Threads jclass, jmethodID, and jfieldID Local and Global References UTF-8 and UTF-16 Strings Primitive A
阅读全文
摘要:Keeping Your App Responsive 官方文档 https://developer.android.google.cn/topic/performance/vitals/anr 1.In this document What Triggers ANR? How to Avoid A
阅读全文
摘要:Creating a Manager for Multiple Threads Creating a Manager for Multiple Threads 1.You should also read Processes and Threads The previous lesson showe
阅读全文
摘要:Manipulating Broadcast Receivers On Demand Manipulating Broadcast Receivers On Demand This lesson teaches you to Toggle and Cascade State Change Recei
阅读全文