Android Development on the road: less to step on the pit, take more shortcuts

Source: Internet
Author: User
Tags tinypng

1. What models do you usually need to test after Android app is developed?

  2. Currently, what are the resolutions to consider when developing Android apps?

These two questions can be answered together.


Data from Google Play is updated every month to keep abreast of the Android version scale trend.

Screen density data

OpenGL es version

can also refer to a domestic third-party data:

At present, Samsung and Xiaomi market share is far ahead, Samsung Note2, Note3, S3, S4, S5, millet 123, red rice must test, Meizu also compare pit Dad, join the test list it. Select one of the small screens (such as Huawei C8650, Moto ME511).

Android 1.5, 1.6, 2.0, 2.1 and small screen belonging to the antique-level machines, the market stock is very small, the new machines are more than 4.0, so need to abandon the support for antiques, because the adaptation cost is very high, for the newly developed applications, this adaptation is not worth investing.

  3. What are the technical options for adapting to multiple resolutions at the moment when developing Android apps?


Android screen adaptation, can be processed in the project res directory, without writing code, Android automatically find the most suitable resources to display, I believe everyone is quite familiar with.

I'm currently using ADT22.6, a new Android project that will automatically generate this directory structure in the Res directory. There are 5 folders with the prefix drawable, which correspond to the image resources or styles of different density screens.

To be a normal app, developers need to follow a few development rules, and designers need a set of standards to design the Android UI, and all of the Android UI design guides are here.


9Path this easy-to-use tool, very practical, must be recommended.

Draw an icon, all to the n resolution, each mechanical operation is a bit weak explosion, recommend a cow x tool:

The function can automatically graph the output of various screen density icon, visual build layout, automatically generate layout files.


Recommend this, the designer should be very fond of, the second cut diagram.

In the actual development, taking into account the size of the package, will not be in all drawable with different size of the picture resources, but only a set of picture resources, writing a different layout. Individual special image resources in each drawable folder in the corresponding size, such as program icon, do not press the file folder may cause distortion in the launcher display.

Although no changes can be run on the Android pad, but because the pad screen is large, the operation experience is not the same, it is recommended to redesign.

  4. where should the profile be placed when developing the Android app (app local, remote Web Server )?  What should be considered?

This depends on the demand, if only the use of the machine, such as saving software settings, do not need to network operation, the preferred course is saved locally.

If the business needs to interact with the server, it can be configured as a cloud. For cross-platform compatibility, consider using Google's protobuf, which is smaller, faster and simpler than XML, and the backend and terminal define a set of protocols that automatically generate C + +, Java, or Python code.


  5. What are the factors commonly considered in the Android APP test scenario?  Is there a reference instance of the test scenario?

  model Adaptation: screen size, this can only be manually tested (the program does not know that your UI is not good to see)

Android version (some API not on the lower version, will crash, recommend lint static scan)

  Network quality: Unicom, Telecom, Mobile, WiFi, weak network, etc.

  Security: network data must be encrypted, local does not save security information (account password, etc.), or encrypted save

Sensitive information in code as far as possible using a byte array instead of string code obfuscation (Proguard)

SD card has little remaining space, no SD card, dual SD card, flight mode, time error and so on.

  Performance: CPU, memory consumption (development can use the Linux top command or DDMS inside the tool)

Network traffic consumption (there are various third-party traffic monitoring software)

  6. when developing Android APP , in order to improve work efficiency, improve project quality, usually need to abstract some Lib out, please list the commonly used interface name and purpose.

More wonderful can be on GitHub search, this is not swim.

  7. Other issues that need to be alerted in Android app development

android4.4 the UI thread is not able to perform network operations not only the Android API version does not necessarily cause the exception to run, some models are also compiled with Java 1.5, and some Java 1.6 functions are crash.

Note The oom problem, the Android phone now has 3G of memory, but not an application can use all the memory. Learn about heap memory, a software at least one process, a process running a virtual machine, the process using the heap memory size, each phone is not necessarily the same.

Show dialog question, always judge whether the activity is still there.

A high-version API function was used and was hung on the lower version of the machine.

A non-UI thread cannot manipulate the UI. There may be issues with various permissions being banned.

No browser, no software installer, no email and so on activitynotfoundexception.

The super-fast continuous click button may trigger the problem of running multiple threads.

Android4.4 SMS permission settings, the native system with a new interface, the third-party system may be cut off.

  8. Under what circumstances does oom occur and how to avoid it?

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

  9. What happens to ANR?

If an Android program waits more than 5s for an operation to occur, a dialog box with the ANR (application not responding) will appear, which cannot be performed on the main thread for time-consuming operations such as network operations (Android 4.4 does not allow you to do so). These tasks should run outside the main thread, such as creating a new thread, or writing a network engine to manage all network requests.

  10. How to track research and development quality?

Coverity Access:

Code defect Scan, do not sweep do not know, a sweep startled. Recommended! Fro free! If you are writing open source code, you can also access GitHub directly, super convenient.

Crash is unavoidable, what we can do is to reduce the crash situation as much as possible. Issued to the version, the user has crash, we need to collect crash data. So the software needs to do a crash escalation, summary collation. Count the crash rate for each version and fix the crash by priority.

Of course, the version check update is also indispensable.

  11. What if the user's feedback on the product is tracked?

No matter how much technology you use to write software, users don't know or care. The user is concerned about how much your product experience has to do with B. Plus the feedback function that the user can easily feedback, you will find that sometimes the user idea is good.

Do out of the product is good or bad, need to have product data support, so plug-in related data statistics reporting point, which feature hot, how many new users, active users how much, at a glance.

  12. Security check

To avoid unexpected jumps or malicious attacks, the Android component needs to determine whether the incoming parameters are empty at startup.

Sensitive information requires permission restrictions or encryption processing.

Components that are not exposed are not exposed, and the component is added android:exported= "false" property in Androidmanifest.

Components that need to be exposed are called through custom permissions, adding custom permissions android:permission= "Yourapp.permission.CALL" detects webview vulnerabilities Index.php/opensource/detail/1

  13. What are the common tools:

Lint (cleanup resources, security checks, layout optimization, etc.)

Generally before the test to clean up the redundant resources, check if there are some high API level only interface, check the security issues.

Findbugs (check for Java code defects)

In the development of the project can be a single file inspection, there are problems can be dealt with in a timely manner.

MAT (Memory leak debugging tool)

When encountering memory or performance problems, it is common to combine several tools to check for problems and find solutions.

Method Profiling (Statistical methods time-consuming)

Eclipse Class Decompiler (from this eclipse is not afraid to see the code inside the jar package)

Hierarchy Viewer (view activity stack, layout load level, pixel eye)

Can only connect the development Board mobile phone or simulator, if your phone is not connected, search "Hierarchy Viewer real Machine", a variety of tutorials teach you how to connect.

Activity too much, sometimes problems, but can not remember what this page name, plug it up, at a glance.

It is clear that the layout hierarchy of layouts can also show that the calculation layout is time-consuming, drawing time-consuming, and UI performance optimization Good helper.

Tinypng (compressed picture resource, Shanbengdelie recommended)

7z (compression apk weapon, press on the line before you can, simple and practical, five-star recommended)

Apktool, Dex2jar, Jd-gui (anti-compilation kit, you know)

Mark Man (the designer is a difficult engineer)

Beyond Compare (Comparison of various gods, I like to compare the code)

  Tcpdump (Linux dump package tools)

adb shell tcpdump-p-vv-s 0-w/sdcard/capturenet.pcap

WireShark (View network Dump package)

They need help to solve difficult problems.

CMD (very simple script can greatly improve efficiency, everyone learn more share)

Some frequently-used actions, which are time-consuming, cumbersome, and error-prone, can be very efficient with command-line operations.

Drag and drop installation application, no more pop xx assistant xx polaris snail speed installed (speed, good mood):

adb install%1


To uninstall an app:


Pull away SD card directory file

ADB Pull/sdcard/test/log C:testlog

Get Contact DB

ADB pull/data/data/ c:contact2.db

Tcpdump Bag

adb shell tcpdump-p-vv-s 0-w/sdcard/capturenet.pcap

SDK cropping Package

Cut Catalog: rd/s/q s:tencentsrcagj

Cutting documents: Del

Original link:

Android Development on the road: less to step on the pit, take more shortcuts

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.