Building Android Apps 30条建议
Building Android Apps — 30 things that experience made me learn the hard way
There are two kinds of people — those who learn the hard way and those who learn by taking someone’s advice. Here are some of the things I’ve learned along the way that I want to share with you:
- Think twice before adding any third party library, it’s a really seriouscommitment;
- If the user can’t see it, don’t draw it!;
- Don’t use a database unless you really need to;
- Hitting the 65k method count mark is gonna happen fast, I mean really fast! And multidexing can save you;
- RxJava is the best alternative to AsyncTasks and so much more;
- Retrofit is the best networking library there is;
- Shorten your code with Retrolambda;
- Combine RxJava with Retrofit and Retrolambda for maximum awesomeness!;
- I use EventBus and it’s great, but I don’t use it too much because the codebase would get really messy;
- Package by Feature, not layers;
- Move everything off the application thread;
- lint your views to help you optimize the layouts and layout hierarchies so you can identify redundant views that could perhaps be removed;
- If you’re using gradle, speed it up anyway you can;
- Do profile reports of your builds to see what is taking the build time;
- Use a well known architecture;
- Testing takes time but it’s faster and more robust than coding without tests once you’ve got the hang of it;
- Use dependency injection to make your app more modular and therefore easier to test;
- Listening to fragmented podcast will be great for you;
- Never use your personal email for your android market publisher account;
- Always use appropriate input types;
- Use analytics to find usage patterns and isolate bugs;
- Stay on top of new libraries (use dryrun to test them out faster);
- Your services should do what they need to do and die as quickly as possible;
- Use the Account Manager to suggest login usernames and email addresses;
- Use CI (Continuous Integration) to build and distribute your beta and production .apk’s;
- Don’t run your own CI server, maintaining the server is time consuming because of disk space/security issues/updating the server to protect from SSL attacks, etc. Use circleci, travis or shippable, they’re cheap and it’s one less thing to worry about;
- Automate your deployments to the playstore;
- If a library is massive and you are only using a small subset of its functions you should find an alternative smaller option (rely onproguard for instance);
- Don’t use more modules than you actually need. If that modules are not constantly modified, it’s important to have into consideration that the time needed to compile them from scratch (CI builds are a good example), or even to check if the previous individual module build is up-to-date, can be up to almost 4x greater than to simply load that dependency as a binary .jar/.aar.
- Start thinking about ditching PNGs for SVGs;
- Make library abstraction classes, it’ll be way easier to switch to a new library if you only need to switch in one place (e.g.AppLogger.d(“message”) can contain Log.d(TAG, message) and later realise that Timber.d(message) is a better option);
- Monitor connectivity and type of connection (more data updates while on wifi?);
- Monitor power source and battery (more data updates while charging?Suspend updates when battery is low?);
- A user interface is like a joke. If you have to explain it, it’s not that good;
- Tests are great for performance: Write slow (but correct) implementation then verify optimizations don’t break anything with tests.
If you have any questions drop me a tweet @cesarmcferreira!
form:https://medium.com/@cesarmcferreira/building-android-apps-30-things-that-experience-made-me-learn-the-hard-way-313680430bf9#.iz9oy4ekc
Building Android Apps 30条建议的更多相关文章
- 后端程序员必备:书写高质量SQL的30条建议
前言 本文将结合实例demo,阐述30条有关于优化SQL的建议,多数是实际开发中总结出来的,希望对大家有帮助. 1.查询SQL尽量不要使用select *,而是select具体字段. 反例子: sel ...
- Java代码编写的30条建议
1) 类名首字母应该大写.字段.方法以及对象(句柄)的首字母应小写.对于所有标识符,其中包含的所有单词都应紧靠在一起,而且大写中间单词的首字母.例如: ThisIsAClassName thisIsM ...
- mysql优化30条建议
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索 ...
- 写好Java代码的30条经验总结(转)
成为一个优秀的Java程序员,有着良好的代码编写习惯是必不可少的.下面就让我们来看看代码编写的30条建议吧. (1) 类名首字母应该大写.字段.方法以及对象(句柄)的首字母应小写.对于所有标识符,其中 ...
- 写好Java代码的30条经验总结
成为一个优秀的Java程序员,有着良好的代码编写习惯是必不可少的.下面就让我们来看看代码编写的30条建议吧. (1) 类名首字母应该大写.字段.方法以及对象(句柄)的首字母应小写.对于所有标识符,其中 ...
- Android开发60条技术经验总结
Android开发60条技术经验总结,以下是全文: 1. 全部Activity可继承自BaseActivity,便于统一风格与处理公共事件,构建对话框统一构建器的建立,万一需要整体变动,一处修改到处有 ...
- Android 开发60条技术经验总结(转)
Android 开发60条技术经验总结: 1. 全部Activity可继承自BaseActivity,便于统一风格与处理公共事件,构建对话框统一构建器的建立,万一需要整体变动,一处修改到处有效. 2. ...
- 将Web应用性能提高十倍的10条建议
导读 提高 web 应用的性能从来没有比现在更重要过.网络经济的比重一直在增长:全球经济超过 5% 的价值是在因特网上产生的(数据参见下面的资料).这个时刻在线的超连接世界意味着用户对其的期望值也处于 ...
- <转>“人脉投资”的10条建议
谁都知道人脉很重要,所以有些人非常勤奋的“做人脉”,他们往往会这样做—— 积极的参与各类线下活动,逢人就换名片.加微信. 见到名人或者重要人物必合影,而且他们还会掏出手机来给你看. 逢年过节,给所有他 ...
随机推荐
- (转+原)ipp "No dlls were found in the Waterfall procedure"
转自: http://blog.csdn.net/hua_007/article/details/9112909 1,吧 dll的目录放到系统环境变量中 intel 的官方推荐.验证是ok的. --- ...
- checkbox 实现单选效果(html)
note:在html <input> 标签类中的checkbox实现单选效果. 在最近的开发项目中,客户要求使用小方格子实现“单选”功能,显然圆点的radio被out了,只能选择chckb ...
- 谈谈自己对于Auth2.0的见解
Auth的原理网上有很多,我这里就不在赘述了. 这里有张时序图我个人觉得是比较合理而且直观的,(感谢这篇博文:http://justcoding.iteye.com/blog/1950270) 参照这 ...
- TF卡座(外焊、内焊、掀盖式、全塑、简易)
TF卡座(外焊.内焊.掀盖 式.全塑.简易
- Planner – 项目管理软件
http://www.appinn.com/planner/ Planner 是一款开源.易用.跨平台的项目管理软件.@appinn 二猪用了 OpenProject 几年,现在已经受够了它的各种 ...
- Android APP开发需求文档范本
Android APP开发需求文档范本 软件需求文档格式的标准写法 1.引言 1.1 编写目的 • 阐明开发本软件的目的: 1.2 项目背景 • 标识待开发软件产品的名称.代码: • 列出本项目的任 ...
- Windows多线程同步系列之四-----信号量
信号量说实话自己没怎么使用过.书上大概这样说,信号量设置一个资源访问计数.当该计数值大于0的时候,该信号量对象 为有信号状态,当该计数值等于0的时候,该信号量对象为无信号状态. 我们来查几个主要的AP ...
- 网易云课堂_C++开发入门到精通_章节6:多态
课时33示例--为多态基类声明虚析构函数 微软校园招聘笔试题 #include <iostream> class Base { public: char Value() { return ...
- GDB+GDBServer调试Linux应用程序
参考:http://blog.csdn.net/shanghaiqianlun/article/details/7820401 一.gdb+gdbserver总体介绍 远程调试环境由宿主机GDB和目标 ...
- django 启动和请求
Django运行方式 调试模式 直接 python manage.py runserver python manage.py runserver python manage.py runserver ...