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:


  1. Think twice before adding any third party library, it’s a really seriouscommitment;
  2. If the user can’t see it, don’t draw it!;
  3. Don’t use a database unless you really need to;
  4. Hitting the 65k method count mark is gonna happen fast, I mean really fast! And multidexing can save you;
  5. RxJava is the best alternative to AsyncTasks and so much more;
  6. Retrofit is the best networking library there is;
  7. Shorten your code with Retrolambda;
  8. Combine RxJava with Retrofit and Retrolambda for maximum awesomeness!;
  9. I use EventBus and it’s great, but I don’t use it too much because the codebase would get really messy;
  10. Package by Feature, not layers;
  11. Move everything off the application thread;
  12. lint your views to help you optimize the layouts and layout hierarchies so you can identify redundant views that could perhaps be removed;
  13. If you’re using gradle, speed it up anyway you can;
  14. Do profile reports of your builds to see what is taking the build time;
  15. Use a well known architecture;
  16. Testing takes time but it’s faster and more robust than coding without tests once you’ve got the hang of it;
  17. Use dependency injection to make your app more modular and therefore easier to test;
  18. Listening to fragmented podcast will be great for you;
  19. Never use your personal email for your android market publisher account;
  20. Always use appropriate input types;
  21. Use analytics to find usage patterns and isolate bugs;
  22. Stay on top of new libraries (use dryrun to test them out faster);
  23. Your services should do what they need to do and die as quickly as possible;
  24. Use the Account Manager to suggest login usernames and email addresses;
  25. Use CI (Continuous Integration) to build and distribute your beta and production .apk’s;
  26. 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;
  27. Automate your deployments to the playstore;
  28. 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);
  29. 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.
  30. Start thinking about ditching PNGs for SVGs;
  31. 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);
  32. Monitor connectivity and type of connection (more data updates while on wifi?);
  33. Monitor power source and battery (more data updates while charging?Suspend updates when battery is low?);
  34. A user interface is like a joke. If you have to explain it, it’s not that good;
  35. 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条建议的更多相关文章

  1. 后端程序员必备:书写高质量SQL的30条建议

    前言 本文将结合实例demo,阐述30条有关于优化SQL的建议,多数是实际开发中总结出来的,希望对大家有帮助. 1.查询SQL尽量不要使用select *,而是select具体字段. 反例子: sel ...

  2. Java代码编写的30条建议

    1) 类名首字母应该大写.字段.方法以及对象(句柄)的首字母应小写.对于所有标识符,其中包含的所有单词都应紧靠在一起,而且大写中间单词的首字母.例如: ThisIsAClassName thisIsM ...

  3. mysql优化30条建议

    1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索 ...

  4. 写好Java代码的30条经验总结(转)

    成为一个优秀的Java程序员,有着良好的代码编写习惯是必不可少的.下面就让我们来看看代码编写的30条建议吧. (1) 类名首字母应该大写.字段.方法以及对象(句柄)的首字母应小写.对于所有标识符,其中 ...

  5. 写好Java代码的30条经验总结

    成为一个优秀的Java程序员,有着良好的代码编写习惯是必不可少的.下面就让我们来看看代码编写的30条建议吧. (1) 类名首字母应该大写.字段.方法以及对象(句柄)的首字母应小写.对于所有标识符,其中 ...

  6. Android开发60条技术经验总结

    Android开发60条技术经验总结,以下是全文: 1. 全部Activity可继承自BaseActivity,便于统一风格与处理公共事件,构建对话框统一构建器的建立,万一需要整体变动,一处修改到处有 ...

  7. Android 开发60条技术经验总结(转)

    Android 开发60条技术经验总结: 1. 全部Activity可继承自BaseActivity,便于统一风格与处理公共事件,构建对话框统一构建器的建立,万一需要整体变动,一处修改到处有效. 2. ...

  8. 将Web应用性能提高十倍的10条建议

    导读 提高 web 应用的性能从来没有比现在更重要过.网络经济的比重一直在增长:全球经济超过 5% 的价值是在因特网上产生的(数据参见下面的资料).这个时刻在线的超连接世界意味着用户对其的期望值也处于 ...

  9. <转>“人脉投资”的10条建议

    谁都知道人脉很重要,所以有些人非常勤奋的“做人脉”,他们往往会这样做—— 积极的参与各类线下活动,逢人就换名片.加微信. 见到名人或者重要人物必合影,而且他们还会掏出手机来给你看. 逢年过节,给所有他 ...

随机推荐

  1. jdk配置环境变量

    介绍在linux下配置jdk环境变量的几种常用方法. 首先在linux下安装jdk,如果出现提示权限不够(且root下也提示权限不够),可用#ls -l filename命令查看一下,如果显示类似如: ...

  2. php代码查询apache模块

    <?php print_r(apache_get_modules()); ?> 注:此函数仅适用于CGI模式.

  3. WordPress主题制作全过程

    前言: 我想大多数使用WordPress的朋友都喜欢去尝试新的主题,但是换来换去,总是找不到那么一款适合自己的,让人很郁闷.于是很多人萌生了修改现有主题或自己动手从头制作一个主题的想法,但是问题又来了 ...

  4. DOM和jQuery

    一.DOM 在学习DOM之前你应该已经具备了以下三个知识点的应用:HTML CSS javascript DOM 是 W3C(万维网联盟)的标准. W3C DOM 标准被分为 3 个不同的部分: 核心 ...

  5. C语言基本概念

    1. 标准C语言 C语言诞生于20世纪70年代,年龄比我们自己还要大,期间产生了很多标准,但是各种编译器对标准的支持不尽相同. ANSI C是使用的最广泛的一个标准,也是第一个正式标准,被称为“标准C ...

  6. C++之------虚函数

    今天又是周日,公司工业区这里九月份每个周日都会停电一天.停电停网,是没法活的.我们直接去老大家. 老大当爸爸了,回家一段时间了.听说孩子出生就不乖,很折腾他爸妈,这小家伙新生命二代.也愿小家伙早日康复 ...

  7. js加载优化-二

    http://www.cnblogs.com/radom/archive/2011/04/26/2028886.html ontrolJS 主要为了是解决网页加载中Js文件的性能问题,ControlJ ...

  8. 【Xamarin挖墙脚系列:关闭 OS X El Capitan 中 SIP 安全设置功能】

    比如需要修改内核配置文件: com.apple.Boot.plist 那么我们需要解锁权限. 禁止SIP模式,那么就可以修改此文件了. 在 OS X El Capitan 中有一个跟安全相关的模式叫 ...

  9. java Socket 使用注意

    Socket s = new Socket(ia, port); BufferedOutputStream bufOut = new BufferedOutputStream(s.getOutputS ...

  10. HBase 4、Phoenix安装和Squirrel安装

    描述 现有hbase的查询工具有很多如:Hive,Tez,Impala,Shark/Spark,Phoenix等.今天主要记录Phoenix. phoenix,中文译为“凤凰”,很美的名字.Phoen ...