Best practices on Android Developmentuse Gradle and its recommended project structure use Gradle and its recommended engineering structure put passwords and SE Nsitive data in gradle.properties places the password and sensitive data in gradle.properties. Don ' t write your own HTTP client, use volley or OkHttp libra Ries do not write their own HTTP client docking, using the open source framework volley and okhttp (translator: Actually there are several other also good, REQUEST,LOOPJ) use the Jackson library to parse JSON Data uses Jaskson to parse JSON data (translator: Fastjson's Android version is also good) Avoid guava and use only a few libraries due to the
65k Method Limit
Because of the Limited number of Android 65k methods, Avoid using guava open source packages and use only a small number of open source packages (translator: Because Android supports 65,536 methods, so pay special attention)Use fragments to represent a UI screen uses fragment to present the interface using activities just to manage fragments using activity to manage fragmentlayout XM Ls is code, organize them well layout XML is also a program, to manage the use of styles to avoid duplicate attributes in layout xmls using styles to avoid duplicate configuration parameters in the layout xml Use multiple style files to avoid a single huge one uses multiple style configurations to avoid centralizing to a huge style profile keep your colors.xml short and DRY, just define The palette keeps color.xml short, only a few colors of the palette can be also keep dimens.xml DRY, define generic constants also keep dimens.xml short, configure only common constants do Not makes a deep hierarchy of viewgroups do not let the layout hierarchy be deeply avoid client-side processing for webviews, and beware of leaks avoid processing multiple w on the client Ebview, pay particular attention to object overflow using Robolectric for unit tests, Robotium for connected (UI) tests unit test with Robolectric, Robotium for UI connection test use Genymotion as your emulator use Genymotion as simulator always use Proguard or dexguard stick to Proguard and dexguard to protect code
Recommendations for Android Best practices (translated from android-best-practices)