Android development experience Sharing: resources, UI, library, test, build one can not be less

Source: Internet
Author: User
Tags oauth

In addition to the superb martial arts, each black ninja also needs to equip the best weapons. In the world of software development, good tools can make our lives easier and write better code in less time.

Time went back to 2008, when Android was still young. There are only a few related blogs and Google's official application development tutorials, there are no libraries or code generators, and even mature design patterns are not (except for OOP and some Java practices). We've got a mature OS, great development tools, stable eclipse plugins and other Ides, countless development books and related technical blogs.

Here, I want to share my own tools and tips for developing Android apps, hoping to get people to take a few detours.

1. Resources

All UI guides can be found here. Sometimes we need to find resources quickly, we need toolbar icons, themes, other icons and design resources for a variety of Android apps. Android Assets Studio is one of the best tools. It can generate a variety of resolutions (MDPI, HDPI, xhdpi) launcher, tags, toolbars, menu icons, can be generated according to your color theme, you can also generate toolbar resources for the Sherlock Action bar. Converting and zooming dpi is very painful, so you need Android dpi Calculator

2. UI Components

As long as we follow the official Android UI design concept, we are reusing the UI components. There are a lot of good generic components to take advantage of, and of course you can develop the right components for them based on them. You can find them on Android views. Here I'm only presenting a few "essentials" components:

    • Sherlock Action Bar: Author Jake Wharton. This toolbar design extends the library of support functions and allows you to manipulate each version of the Android toolbar via an API. The library automatically calls the native toolbar at the right time, or encapsulates a custom implementation on your layout basis. This makes it easy for you to develop a toolbar-ready app for all Android versions of 2.x and above.
    • Sliding Menu: This is the most popular UI mode nowadays. Many of the best apps on the Google Play market use this UI model, such as Google Plus, Facebook, YouTube, and other apps that use the sliding Menu.
    • Cards: A very beautiful introduction to the UI component that will make your app look like Google home. You can add one or several cards to the screen.

3. Function library

The Android app is not just a UI, it also includes a lot of color and picture resources. Optimus Prime (translated: "The leader of the righteous side of Transformers") once said: "The truth is not just the sight." We also need to write background code to load and cache pictures, speed up communication with the server, write database operations tools, and so on. Next, we are rightfully reusing some best practice code. My Favorites (and common tools) include:

    • Android Universal Loader: highly customizable image download and load function library. Supports loading from cache or file, configuration is very simple.
    • Spring for Android: If you haven't heard of spring ... So please go and search first. The most popular Java framework has extended his product line to the Mobile world. As they say, "Mobility is the future." Spring for Android offers several great libraries and frameworks, including:
      • Spring Resttemplate: A very popular Java-based rest client. The Spring for Android resttemplate module provides a resttemplate version that works in an Android environment, providing a very flexible rest API for your Android application.
      • Validation support: OAuth is a fast-rising protocol for the field. OAuth is an open source protocol that provides users with third-party app support and provides access to restricted resources or services on other sites.
    • Square: They've released a lot of good library functions on GitHub. My favorite is Retofit, as he introduced, "a type-safe Android and Java rest client."
    • Ormlite: It is often tedious to write and maintain database tables. Ormlite is an ORM framework that supports Android and SQLite. There are often countless options for doing this, but if you are creating an application that requires a large database, perhaps Ormlite will be the best choice for you. The best thing is that--ormlite is driven by annotations.
    • A binder between Androidannotations:ui and code that allows you to write less code and easily maintain existing code.

4. Testing

As a developer, we do some testing from time to times. After all, we have to make sure that the programs we develop work properly. It is certainly best to follow test-driven development (TDD), but sometimes we just need some simple tests. This is only my personal opinion, the final choice is always in your hands.

    • Monkey: Check if the application will have the simplest, fastest, and most effective method of ANR (Translator Note: applicationnotresponding application not responding). It performs n random clicks on your app. You can run the monkey during your lunch break.
    • Safe.i J I A M i:android app vulnerability Detection Tool, you can upload a button to test the existence of the application of information security vulnerabilities, signature information vulnerability, source code security vulnerabilities, according to the existing loopholes can be corresponding solutions, a powerful Android development must be one of the tools.
    • Android Test: A JUnit-based Android testing framework. It provides all types of tests. You can write test cases for ui/activities. Functional testing or Black box UI testing does not require testers to understand the implementation details of the application, but only the user's perspective on how to perform a particular action or what the output will be if a particular content is entered. This approach allows developers and testers to work independently in your organization.
    • Robotium: This is an Android automated testing framework that supports both native and hybrid applications. With Robotium you can easily write powerful, robust black-box test cases. Test developers can write functional tests, system tests, and acceptance test cases that cover a variety of Android operations. In addition, Robotium also has a very active developer forum.
    • Cloud Testing: You can run your tests on a large number of devices and get all the crashes and error messages. The relevant tools are:
      • Skyforge
      • Bitbar
      • Cloudmonkey
      • Perfecto Mobile

They are not free, but they do.

5. Build

This is my favorite part. We work day in and year out ... it's time to show off your products. Your app may be split into paid, free or exclusive editions. They will have generic parts and some proprietary logic. Maybe you'll have a custom app for 100 customers, different package names, colors, names, resources and product styles .... Did I mention the build version? A development version, different stages of beta, production beta, customer beta ... (software version naming) and so on. For different applications, there is no headache problem, how to protect safety? In today's packaging party flooding, all kinds of unsafe mobile internet era, if you do not pay attention to security this piece, it is to dig a hole for themselves! In this, I recommend my experience, the solution is to seek third-party service platform encryption technology, can achieve their own purposes, but also save their own time to study, energy!

At the end of a day's work, the secret is to maintain and manage the release process. For this work, I only recommend the following build tools.

    • Ant: I started with Ant because it's one of the most familiar tools for Java developers. If you build an Android project through Ant, you'll write a build.xml that contains all of the default build tasks, and it will do some simple work for you. If you need more advanced features, take a deep breath and be prepared to delve further into it ... This is a more daunting task if you are going to rely on management.
    • Maven: One of my friends once said: "Maven managed Android app only Hello World". MAVEN is never officially supported by Google or Android. Several MAVEN plugins developed by the community will crash on every new version of the Android build tool. Maven configuration is difficult, but maintenance and operation is easy. Its dependency management is doing well, but many of the Android libraries are not included in the MAVEN master repository.
    • Gradle: Google io 2013 released the Gradle. It is an official Android-supported build tool and part of the Android Studio IDE. Spring and several other industry giants are also supporting Gradle. I found Gradle's grammar simple and easy to understand. I managed to build a simple project, a project with complex build logic and migrated 3 projects from Ant/maven to Gradle within 24 hours. Gradle's dependency management is great and supports getting (pulling) files from Maven and Ivy warehouses as well as multi-project builds. I have to say: Gradle is the new Android official build tool, the relevant Android plugin will soon be developed and supported in the near future, so continue to focus.

I always encourage developers to use and reuse tested concepts, patterns, frameworks, and libraries of functions. Of course, only for the release of the product. You always need to learn and experiment with new tools and new frameworks. Because even the worst ninjas need to sharpen their Samurai swords:)

Happy programming!

Android development experience Sharing: resources, UI, library, test, build one can not be less

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: info-contact@alibabacloud.com 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.