本文共 2963 字,大约阅读时间需要 9 分钟。
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 use a database unless you really need to;
- Hitting the 65k method count mark is gonna happen fast, I mean really fast! And ;
- is the best alternative to ;
- is the best networking library there is;
- Shorten your code with ;
- Combine for maximum awesomeness!;
- I use and it’s great, but I don’t use it too much because the codebase would get really messy;
- ;
- Move everything off the application thread;
- 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 ;
- Do of your builds to see what is taking the build time;
- Use a architecture;
- ;
- Use to make your app more modular and therefore easier to test;
- Listening to will be great for you;
- ;
- Always use input types;
- Use analytics to find usage patterns and isolate bugs;
- Stay on top of new (use to test them out faster);
- Your services should do what they need to do and die as quickly as possible;
- Use the 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;
- If a library is massive and you are only using a small subset of its functions you should find an alternative smaller option (rely on 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 ;
- 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 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;
- .
If you have any questions drop me a tweet @!
form:https://medium.com/@cesarmcferreira/building-android-apps-30-things-that-experience-made-me-learn-the-hard-way-313680430bf9#.iz9oy4ekc
转载地址:http://qqcol.baihongyu.com/