Android developers - how to quickly design and develop an Android App

This article Choose from development tools, several aspects of the UI interface, image module, network module, a database product selection, performance, security, and tells if a developing Android applications. Now sorted out the majority share of Android programmers brothers.

Choice of development tools

Development tools I will choose Android Studio, it is Google's official Android development tools. Android Studio advantage you do not need to say, most of the Android open source library on GitHub also migrated to Android Studio up, when not provided jar file, use Android Studio can be very easily integrated open source libraries. Most importantly, Google has announced that it will cease all support for Eclipse Android development tools (Google Ends Support for Android Eclipse Tools) before the end of the year, so make the transfer as soon as possible to come up Android Studio.

App design

This is for a developer, it looks like there is no decision, the final decision in the hands of product sectors. Despite this, I will try to convince goods sector will be designed to Material Design App style.

It is said that more tears ah, as an Android developer, but all day long to develop the style of iOS App, I believe that many companies are this way, in order to save cost and time, Android and iOS share a set of UI.

Let me cite one common example, the upper left corner of each page TitleBar Android App put in a back button, which is a must in iOS, but Android has the return key ah, designed for Android is completely superfluous.

Sincerely hope that respect for each operating system product designers style and habits, not to design nondescript products. Material Design provides just such a specification, since the MD specification was released, its elegant design and fresh style has attracted a large number of designers and developers, now more than design MD on Android (official library support existing MD style), even in the CSS, HTML, JavaScript web design are more and more fire. Thus, for App design style, Material Design doing my part, maybe you have missed the Android Design, please do not miss the Material Design.

Some related links:

  • Material Design official website
  • Material Design color template
  • MD a website design case
  • MD-style Andorid drawer Source: Android-MaterialDesign-NavigationDrawer
  • MD-style App a source (there sister oh): Android-MaterialDesign-DBMZ

Version Support

For the lowest version of Android to be supported, refer to the various versions of market share, in fact, is the most likely to decide their own App according to statistics, at present our minimum App support 2.2. Personal view is that, although there are still some version 2.x users, but in fact the mobile phone replacement quickly, for a better user experience, and to apply API update (version has many third-party libraries required), should raising the minimum supported version, about 3.0 appropriate, that API Level 11.

App design framework

I believe we have the experience, with the increase of functional modules, App growing, if there is no good architecture, the code will become bloated and difficult to maintain the degree of coupling of the functional modules will be higher. App can be modular so, a complete App divided into several independent modules, so that can reduce the coupling between modules also facilitates multiplexing.

1. The network module

There are very few stand-alone version of App of it, most of them require networking, request data from the server, so the network module module is essential. GitHub open source web framework on the particularly large number of individual that you can use open-source framework now I would choose okHttp or Volley, maybe I will have a better network frame appears. Note that if you use open-source framework, you have to read the source code, must be able to control it, so they would not do anything when the bug occurs. Of course, you can also write your own network module, our current App network module would be entirely their own writing, so that the benefits themselves familiar with the code written when a bug can quickly locate problems, taking care to deal with the details of the networking process ,Such as:

(1) Support for HTTPS, HTTPS certificate validation (currently a lot of practices are allowed by default all HTTPS certificates, in fact, doing so is unsafe and should really do certificate verification)

(2) Support Wap-up Internet access, Mobile, China Unicom, Telecom proxy settings

(3) supports redirection, data compression and transmission of

(4) Other noteworthy problems

Write your own network framework can perfectly handle these details, but the time cost is relatively large. If you use open-source framework, generally do not deal with these details, so we can make some changes on third-party frameworks, such costs will save a lot of time.

2. Image Management Module

App in the picture also essential elements, but the big picture is occupied by memory, image management framework therefore particularly important, bad picture frame is easy to cause a memory leak even cause a crash. Of course, you can implement your own picture frame (we are currently doing so), to achieve download pictures, decoding, caching and other key aspects. Personal recommendations can use some good stock, it may be more efficient than our own sound and picture management. I would recommend the following several Pictures Gallery:

(1) Glide, Google some of the official App, such as Google photos are used, but also explain more?

(2) Fresco, FaceBook open source library function super powerful, supports WebP, Gif, JPEG progressive display, the key is the design of the picture memory, making the picture memory overhead is greatly reduced.

(3) Android-Universal-Image-Loader, prior to the above gallery appears, looks like the hottest, before personal App also used it.

(4) Picasso, Square open source library, Glide is said to refer to Picasso design.

3. Local database module

Maybe your App need to use a local database, it is recommended that you use the popular ORM frameworks, such as ActiveAndroid or greenDAO, using third-party libraries will greatly facilitate your operations on sqlite, personally I think that we need to pay attention in use and multi-threaded database upgrade database concurrency problems.

4. File Management Module

A App, will certainly involve some files, such as configuration files, images, video, audio, SharedPreferences files. We can offer a global document management module is responsible for the file add, delete, change, and other operations. Also a need to support file compression, file upload and download operations for downloading need to support multi-threaded download, HTTP and other functions.

5. The assembly of the inter-component communication mechanism

For a the App, an essential component in communication, the communication type can be divided into the point to point communication and the opposite point, i.e. there is only point to point response message recipient, the opposite point is similar broadcast message, i.e., all the registered can respond messages. In Android, typically implemented using a message mechanism, but the mechanism for coupling the message is relatively high. There are also some communication framework, such as EventBus, Otto and other event bus frameworks can greatly reduce the coupling between components, but can not achieve a perfect point to point communication, it is recommended that message mechanism and the mechanism used in conjunction with the event bus.

6. Data processing framework

In fact, it should have a frame data processing, when the request for data (down sub-thread), via the network module returns data (typically JSON format), JSON data can not be directly used to View layer, need to be resolved to the corresponding Model, Meanwhile, if necessary, a data cache, these processes can be abstracted into a frame data processing. This framework can be considered acceptable url requested data, the data is returned to the Activity Model or Fragment. For JSON data analysis, recommended fastjson, fast and stable, the default value is relatively perfect.

7. thread scheduling module

In fact, Android has a lot of action, such as requesting data, download pictures, clear the cache, etc. are to be executed in the child thread, often most of the time direct from a Thread do, and will do so much mess and thread It will be difficult to manage. So you can abstract a thread scheduling module, which maintains a thread pool thread if there is a need, then you take a thread by thread scheduling module to do, so to facilitate unified management. Of course, third-party library thread operations we will be unable to return to the thread scheduling module to manage, but other operations related to the threads should be unified treatment.

8. business layer

Business layer is probably four components, Fragment, View, and recommend the use of native components as much as possible, use less custom components, because the native component performance is the best. We also recommend using the MVC pattern is like, as long as good design to manage their own logic, as MVP, MVVM pattern and other personally believe are flawed, in short, to seek a compromise it, gains will lose.

9.APK dynamic loading mechanism

With the increase of the App, extensions, many have adopted mechanisms APK App dynamic loading, also called plug-in technology. Because I have not been applied in the actual App, so inconvenient published several comments. I personally think that this mechanism is very promising, this mechanism will be conducive to decoupling, extensions and partial upgrading of App. Specific reference may be a commercial solution: ApkPlug- mobile application and a modular solution APK open framework of dynamic loading.

10.App Security Considerations

Android App of security issues very few people pay attention, this is indeed a very serious problem, often cracked some good people App. It suggested that some of the core algorithms written in .so libraries, it is important logic on the server side, the request for data encryption, etc., in addition to at least obfuscated code when packaged APK, APK shell mechanism can also be used, in short, such precautions never too many.

Scattershot logically breath write so much, there may be missing content, follow-up will supplement and improve. I think if in accordance with the above principles, at least you can develop a good App.

If you see here, I feel well written articles give a praise chant? If you think there need to be improved, please give me a message. Will be serious inquiry, insufficiently corrected, thank you ~

Finally for Android programmers, in addition to the above knowledge, I am here for everyone to put together some information, including but not limited to high-level UI, performance optimization, mobile architect, NDK, hybrid development (ReactNative + Weex) micro letter applet, Flutter Android and other advanced practice all aspects of technology; we want to help, but also saves everyone time online in search of information to learn, you can also close friends to share a dynamic learning together!

We need to expand more detailed study notes system architecture route poke here. . .

Advanced Android architecture necessary to receive a free learning resources (architecture + video + interview thematic study notes document)

Reproduced in: https: //juejin.im/post/5d0260736fb9a07eb3097601

Guess you like

Origin blog.csdn.net/weixin_34101784/article/details/93182365