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 areallyseriouscommitment;
  2. If the user can’t see it,don’t draw it!;
  3. Don’t use a database unless youreallyneed to;
  4. Hitting the 65k method count mark is gonna happen fast, I mean really fast! Andmultidexingcan save you;
  5. RxJavais thebestalternative toAsyncTasks and so much more;
  6. Retrofitis thebestnetworkinglibrarythere is;
  7. Shorten your code withRetrolambda;
  8. CombineRxJava with Retrofit and Retrolambdafor maximum awesomeness!;
  9. I useEventBusand it’s great, but Idon’tuse it too much because the codebase would get really messy;
  10. Package by Feature, not layers;
  11. Moveeverythingoff the application thread;
  12. lintyour 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 usinggradle, speed it up anyway youcan;
  14. Doprofile reportsof your builds to see what is taking the build time;
  15. Use awell knownarchitecture;
  16. Testing takes time but it’s faster and more robust than coding without tests once you’ve got the hang of it;
  17. Usedependency injectionto make your app more modular and therefore easier to test;
  18. Listening tofragmented podcastwill be great for you;
  19. Neveruse your personal email for your android market publisher account;
  20. Alwaysuseappropriateinput types;
  21. Useanalyticsto find usage patterns and isolate bugs;
  22. Stay on top of newlibraries(usedryrunto test them out faster);
  23. Your services should do what they need to do anddieas quickly as possible;
  24. Use theAccount Managerto suggest login usernames and email addresses;
  25. UseCI(Continuous Integration) to build and distribute your beta and production.apk’s;
  26. Don’t run your ownCIserver, 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 alternativesmalleroption (rely onproguardfor instance);
  29. Don’t use more modules than you actually need. Ifthatmodules are not constantly modified, it’s important to have into consideration that the time needed to compile them from scratch (CIbuilds 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. Startthinking 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 containLog.d(TAG, message)and later realise thatTimber.d(message)is a better option);
  32. Monitor connectivity and type of connection (moredataupdateswhile onwifi?);
  33. Monitor power source and battery (more data updateswhilecharging?Suspend updateswhenbattery 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

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android 压力传感器获取当前压强
  2. Android构建工具Gradle知识2
  3. android下载网络图片并缓存
  4. 个人学习资料汇总(持续更新)
  5. Android 获取values String
  6. Android(安卓)正 N 边形圆角头像的实现
  7. Ubuntu编译ffmpeg4.1.3
  8. android 发送http请求方法和异常解决方法
  9. android之按钮单击事件及监听器的实现方
  10. android tts语音使用的一些资料