LeakMemory
内存泄漏



https://mp.weixin.qq.com/s/tO1yxFs2qNQlQ2bJ8vGzQA
https://www.jianshu.com/p/ac00e370f83d
1 | public class SampleActivity extends Activity { |
kotin Fragment方式
1
2
3
4
5
6
7
8
9
10
11
12
13class MyHandler : Handler {
private var mFragment: WeakReference<Any>
constructor(fragment: Fragment) {
mFragment = WeakReference(fragment)
}
override fun handleMessage(msg: android.os.Message?) {
super.handleMessage(msg)
val fragment = mFragment.get() as PayProFragment
fragment.reloadPay()
}
}
https://developer.android.com/studio/profile/memory-profiler
leakcanary
https://square.github.io/leakcanary/recipes/
https://juejin.im/post/5d617d6851882575e8054fab

内存抖动
Profiler
https://www.bilibili.com/video/BV1oz4y1m7Gw?p=14
App瘦身
大图转成 webapp
svg批量转换
设置
vectorDrawables.useSupportLibrary = true
然后app:srcCompat =
否则会在每个drawable生成一个png图片,达不到效果了。tink修改图片颜色
国际化
1
2
3
4
5android{
defaultConfig{
resConfigs 'en' //只适配英语
}
}这样只会保存 语言的映射
so库
一般像微信用Armeabi-v7a
虚拟机运行 还需要 x86
删除无用资源
1
2
3
4
5debug{
minifyEnabled true // 删除无用代码
shrinkResource true //删除资源文件 minifyEnabled 为true,删除了无用代码,这个才知道删除哪些资源。
}
LeakMemory
https://noteforme.github.io/2018/02/09/LeakMemory/