Android app development shortcuts, let you step on pits less



Recently, a friend asked me a few Android questions and asked me to help me write a small share. I think it is quite helpful for newcomers, so I have this small share.

After the development of Android APP is completed, which models usually need to be tested? What resolutions need to be considered when developing an Android app?

At present, Huawei, Samsung and Xiaomi are far ahead in market share. All Huawei models, Samsung Note2, Note3, S3, S4, S5, Xiaomi 123, and Redmi must be tested. Meizu will join the test list. Then select one of the small screens (such as Huawei C8650, Moto ME511).

Android 1.5, 1.6, 2.0, 2.1 and small screens are antique-level machines, and the market stock is very small. The new machines are all above 4.0, so if necessary, it is necessary to abandon the support for antiques, because the adaptation cost is very high High, for newly developed applications, this adaptation is not worth investing in.

When developing an Android app, where should the configuration file be placed (app local, remote Web Server)? How should it be considered?  

This depends on the needs. If it is only used locally, such as saving software settings and does not require network operation, the first choice is of course to save it locally. If the business needs to interact with the server, it can be configured as a cloud. For cross-platform compatibility, you can consider using Google's ProtoBuf, which is smaller, faster and simpler than XML. The background and terminal define a set of protocols to automatically generate C++, Java or Python code. What factors are usually considered in 

Android APP testing solutions?

Model adaptation: screen size, this can be done by a third-party TestBird , and test hundreds of models at the same time;
Android version: some APIs that are not available in lower versions will crash, and Lint static scanning is recommended;
Network quality: China Unicom, Telecom, Mobile, WiFi, weak network, etc.;
Security: Network data must be encrypted; no security information (account password, etc.) is stored locally, or stored encrypted;
sensitive information in the code should use byte arrays instead of String code obfuscation (Proguard);
There is very little remaining space on the SD card, no SD card, dual SD cards, airplane mode, wrong time, etc.
Performance: CPU and memory usage (you can use the Linux top command or tools in DDMS for
  
development) Other issues that need to be reminded in Android APP development

android4.4 cannot perform network operations in the UI thread Not only the android API version does not necessarily cause abnormal operation, Some models are also compiled with Java 1.5, and some functions of Java 1.6 will crash.

Pay attention to the OOM problem. At present, android phones already have 3G memory, but not one application can use all the memory. Learn about the heap memory, a software has at least one process, a process runs a virtual machine, and the heap memory size used by the process is not necessarily the same for each mobile phone.
  
The problem of Show Dialog is to always judge whether the Activity is still there.
The API function of the higher version is used, and it hangs on the lower version machine.
Non-UI threads cannot manipulate the UI. There may be issues with various permissions being banned.
ActivityNotFoundexception occurs when there is no browser, no software installer, no Email, etc.
Clicking the button in rapid succession can trigger problems with running multiple threads.
Android4.4 SMS permission settings, the native system has a new interface, and the third-party system may be cut out.

When does OOM occur and how to avoid it?

Image operations (image scaling, bitmap generation, etc.), serialization and deserialization of data, etc. consume a lot of memory. Reasonable use of data structures (linked lists and arrays), timely release of references, and use of weak references can reduce the occurrence of OOM.

What should I do if ANR occurs?

If an operation of an Android program waits for more than 5s, an ANR (Application Not Responding) dialog box will appear. For performing time-consuming operations, such as network operations, it cannot be performed on the main thread (Android 4.4 does not allow you to do this). ), these tasks should run outside the main thread, such as creating a new thread for processing, or writing a network engine to manage all network requests.

How to track R&D quality?

Scanning for code defects, if you don't scan it, you don't know, and you will be shocked when you scan it. Full score recommendation! Fro Free! If you write open source code, you can also directly access GitHub, which is super convenient. Crash is unavoidable, what we can do is to minimize the situation of Crash. The issued version, the user has crashed, we need to collect the crash data. Therefore, the software needs to do a Crash report and summarize it. Count the crash rate of each version, and repair the crash by priority.

How about tracking user feedback on a product?

No matter how good the technology you use to write software, users don't know and don't care. What users care about is how good your product experience is. Coupled with the feedback function that users can easily give feedback, you will find that sometimes users' ideas are not bad. Whether the product made is good or not, it needs to be supported by product data, so add relevant data and report points, which features are popular, how many new users, and how many active users are at a glance.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326271853&siteId=291194637