检测工具 lint (a static code analysis tool) : html
http://developer.android.com/tools/help/lint.htmlandroid
A.检测无用的资源文件 windows
F:\adt-bundle-windows-x86_64-20140321\sdk\tools>lint --check "UnusedResources" f:\工程文件目录 > f:\result.txt [文件输出目录]api
警告 :1. import android.R 项目中最好不要包含anroid.R 须要使用的地方直接使用全路径ide
2. Avoid object allocations during draw/layout operations (preallocate and reuse instead)工具
代码 : protected void onMeasure(){oop
........this
DisplayMetrics dm = new DisplayMetrics();google
}.net
3. Consider making the text value selectable by specifying android:textIsSelectable="true"
从android sdk 11起google添加了新api,TextIsSelectable控制TextView是否支持拷贝、粘帖功能
4.This Handler class should be static or leaks might occur Handler 非静态或会引发内存泄漏
Issue: Ensures that Handler classes do not hold on to a reference to an outer class 确保Handler 没有保持一个外部类的引用
Id: HandlerLeak
Since this Handler is declared as an inner class, it may prevent the outer class from being garbage collected. If the Handler is using a Looper or MessageQueue for a thread other than the main thread, then there is no issue. If the Handler is using the Looper or MessageQueue of the main thread, you need to fix your Handler declaration, as follows: Declare the Handler as a static class; In the outer class, instantiate a WeakReference to the outer class and pass this object to your Handler when you instantiate the Handler; Make all references to members of the outer class using the WeakReference object.
解决方案 http://blog.csdn.net/jdsjlzx/article/details/8463428