[Must Have Libraries] Các thư viện cần thiết trong lập trình android

GIỚI THIỆU

Có rất nhiều thư viện của bên thứ ba cho Android có những thư viện cực kỳ phổ biến và thường được sử dụng trong hầu hết các dự án Android. Mỗi thư viện đều có những mục đích khác nhau nhưng tất cả chúng đều làm cho công việc lập trình trở nên dễ chịu hơn. Các thư viện chính được liệt kê dưới đây.

TIÊU CHUẨN

Các thư viện được liệt kê dưới đây là các thư viện khá phổ biến, áp dụng rộng rãi và có lẽ nên được thiết lập trong hầu hết các ứng dụng Android:

Name Description
Retrofit A type-safe REST client for Android which intelligently maps an API into a client interface using annotations.
Glide A powerful image downloading and caching library for Android.
ButterKnife Using Java annotations, makes Android development better by simplifying common tasks.
Parceler Android Parcelable made easy through code generation
IcePick Android Instance State made easy
LeakCanary Catch memory leaks in your apps
Espresso Powerful DSL for Android integration testing
Robolectric Efficient unit testing for Android

 

NÂNG CAO

Các thư viện được liệt kê dưới đây là các thư viện bổ sung được sử dụng nhiều hơn nhưng phổ biến trong số các nhóm Android có kinh nghiệm. Lưu ý rằng các thư viện này có thể không phù hợp với ứng dụng đầu tiên của bạn. Những thư viện tiên tiến này bao gồm:

Name Description
Dagger 2 A fast dependency injector for managing objects.
RxJava Develop fully reactive components for Android.
EventBus Android event bus for easier component communication.
AndroidAnnotations Powerful annotations to reduce boilerplate code.
Retrolambda Bringing lambda block support to Android.

MÌNH ĐỂ NGUYÊN GỐC CHO MỌI NGƯỜI DỄ HIỂU, CHỨ MÌNH DỊCH GOOGLE MỆT LẮM  =)))

Keep in mind that the combination of these libraries may not always play nicely with each other. The following section highlights some of these issues.

Parceler and IcePick

Note that you cannot use IcePick at the current time to save state of Parceler objects. See this GitHub issue for more context on why they are incompatible. You will need to use explicitly Parcelable objects with IcePick. You may consider replacing Parceler with AutoParcel which works seamlessly with IcePick.

ButterKnife and Parceler

Using the Butterknife library with the Parceler library causes multiple declarations of javax.annotation.processing.Processor. In this case, you have to exclude this conflict in your app/build.gradle file:

 packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'  // butterknife
    }

ButterKnife and Custom Views

Often you may find that using ButterKnife or Dagger injections defined in your constructor prevent Android Studio to preview your Custom View layout. You may see an error about needing isEditMode() defined. Essentially this method is used to enable your code to short-circuit before executing a section of code that might be used for run-time but cannot be executed within the preview window.

 public ContentEditorView(Context context, AttributeSet attrs) {
        super(context, attrs);

        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        inflater.inflate(R.layout.view_custom, this, true);

        // short circuit here inside the layout editor
        if(isInEditMode()) {
            return;
        }

        ButterKnife.bind(this);

Convenience

  • Dagger – A fast dependency injector for Android and Java. See this video intro from Square.
  • Spork – Spork is an annotation processing library to speed up development on your projects. It allows you to write less boilerplate code to make your code more readable and maintainable.
  • AutoParcel – Port of Google AutoValue for Android with Parcelable generation goodies.
  • Hugo – Easier logging within your app
  • Logger – Much cleaner and easier logcat trace messages
  • AndroidAnnotations – Framework that speeds up Android development. It takes care of the plumbing, and lets you concentrate on what’s really important. By simplifying your code, it facilitates its maintenance
  • Calligraphy – Custom fonts made easy
  • EasyFonts – Easy preloaded custom fonts in your app
  • AndroidViewAnimations – Common property animations made easy
  • AboutLibraries – Automatically generates an About this app section, with a list of used libraries
  • EasyDeviceInfo – Get device information in a super easy way
  • Sensey – Detecting gestures in a snap.
  • OAuthLibGithub – Easily add Authentication using Github API.
  • Timber – A logger with a small, extensible API which provides utility on top of Android’s normal Log class.
  • LoggingInterceptor – An OkHttp interceptor which pretty logs request and response data.

Extensions

Networking

  • Retrofit – A type-safe REST client for Android and Java which intelligently maps an API into a client interface using annotations.
  • Picasso – A powerful image downloading and caching library for Android.
  • Ion – Powerful asynchronous networking library. Download as a jar here.
  • Android Async HTTP – Asynchronous networking client for loading remote content such as JSON.
  • Volley – Google’s HTTP library that makes networking for Android apps easier and most importantly, faster.
  • OkHttp – Square’s underlying networking library with support for asynchronous requests.
  • Glide – Picasso image loading alternative endorsed by Google
  • Android Universal Image Loader – Popular alternative for image loading that can replace Picasso or Glide.
  • Fresco – An image management library from Facebook.
  • Fast Android Networking -Fast Android Networking is a powerful library for doing any type of networking in Android applications which is made on top of OkHttp Networking Layer.

ListView

  • EasyListViewAdapters – Building multi-row-type listview made much cleaner & easier.
  • GridListViewAdapters – Easily build unlimited Grid cards list like play-store. (ListView working as unlimited GridView)
  • StickyListHeaders – An android library for section headers that stick to the top of a ListView
  • PinnedListView – Pinned Section with ListView
  • ListViewAnimations – Easy way to animate ListView items (DEPRECATED)
  • Cardslib – Card UI for Lists or Grids
  • PullToRefresh-ListView – Easy to use pull-to-refresh functionality for ListViews. Download and install as a library project.
  • QuickReturn – Reveal or hide a header or footer as the list is scrolled in a direction.
  • SortableTableView – The library enables you to display your data in a table and provides numerous customization possibilities. The api was designed very android like so the usage is intuitive for experienced android developers.
  • Paginated Table – This is a table which allows dynamic paging for any list of objects. Icons can be added to columns as well as custom items such as check boxes and buttons.

RecyclerView

  • UltimateRecyclerView – Augmented RecyclerView with refreshing, loading more, animation and many other features.
  • AdvRecyclerView – Extended RecyclerView with swipe to dismiss, and draggable or expanding items.
  • android-parallax-recyclerview – An adapter which could be used to achieve a parallax effect on RecyclerView.
  • sticky-headers-recyclerview – Sticky Headers decorator for Android’s RecyclerView.
  • FastAdapter – Simplify and speed up the process of filling your RecyclerView with data
  • ItemAnimators – RecyclerView animators to animate item add/remove/add/move
  • GreedoLayout – Full aspect ratio grid LayoutManager for Android’s RecyclerView
  • ChipsLayoutManager – RecyclerView’s LayoutManager which moves item to the next line when no space left on the current. Can represent google material chips guideline or tags view.
  • RecyclerViewHelper – Provides the most common functions around recycler view like Swipe to dismiss, Drag and Drop, Divider in the ui, events for when item selected and when not selected, on-click listener for items.
  • async-expandable-list – async-expandable-list provides solutions to displaying header-sub-items structure with simple api and asynchronously loading sub-list into an expandable list.
  • Epoxy – Epoxy is an Android library for building complex screens in a RecyclerView.

Easy Navigation

UI Components

Drawing

  • MPAndroidChart – A powerful Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, dragging and animations.
  • HoloGraphLibrary – Newer graphing library
  • EazeGraph – Another newer library with potential
  • AndroidCharts – Easy to use charts
  • AndroidGraphView – library to create flexible and nice-looking diagrams.
  • AndroidPlot – plotting library for Android
  • WilliamChart – Flexible charting library with useful motion capabilities.
  • HelloCharts – Charts/graphs library for Android with support for scaling, scrolling and animations.
  • Leonids – Simple and easy particle effects (See Tutorial)
  • Confetti – Newer particle effects library.
  • AChartEngine – This is a charting software library for Android applications

Image Processing

Scanning

Persistence

  • ActiveAndroid
  • DBFlow – A robust, powerful, and very simple ORM android database library with annotation processing.
  • greenDAO
  • SugarORM
  • RxCache – Reactive caching library for Android
  • Android-Orma – A type-safe ORM for Android as a wrapper of SQLiteDatabase
  • ORMLite
  • SQLBrite – Lightweight wrapper around SQLiteOpenHelper
  • Cupboard – Popular take on SQL wrapper
  • StorIO – Fresh take on a light SQL wrapper
  • Realm
  • NexusData
  • Hawk – Persistent secure key/value store
  • Poetry – Persist JSON directly into SQLite
  • JDXA – The KISS ORM for Android – Simple, Non-intrusive, and Flexible
  • Schematic – Generate the SQLite and ContentProvider code

Binding

Compatibility

Scrolling and Parallax

This is a list of popular scrolling and parallax libraries:

Debugging

  • Stetho – A debug bridge for Android applications which could be used for multiple purposes not limited to Network Inspection, Database Inspection and Javascript Console.
  • Android Debug Database – Android Debug Database allows you to view databases and shared preferences directly in your browser in a very simple way.
  • Bugfender – Cloud storage for your app logs, track user behaviour to find problems in your mobile apps.
  • Chuck – Chuck is a simple in-app HTTP inspector for Android OkHttp clients. Chuck intercepts and persists all HTTP requests and responses inside your application, and provides a UI for inspecting their content.
  • AnUitor – UI debug tool for Android

Resources

Check out the following resources for finding libraries:

References

https://github.com/codepath/android_guides/wiki/Must-Have-libraries

Nguyễn Linh

Chia sẻ để cùng tiến bộ...