檢測工具 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