2025-06-20

  主要包括那些不錯的開發庫,包括依賴註入框架、圖片緩存、網絡相關、數據庫ORM建模、Android公共庫、Android 高版本向低版本兼容、多媒體相關及其他。

一、依賴註入DI

通過依賴註入減少View、服務、資源簡化初始化,事件綁定等重復繁瑣工作

AndroidAnnotations(Code Diet)android快速開發框架
項目地址:https://github.com/excilys/androidannotations
文檔介紹:https://github.com/excilys/androidannotations/wiki
官方網站:https://androidannotations.org/
特點:(1) 依賴註入:包括view,extras,系統服務,資源等等
(2) 簡單的線程模型,通過annotation表示方法運行在ui線程還是後臺線程
(3) 事件綁定:通過annotation表示view的響應事件,不用在寫內部類
(4) REST客戶端:定義客戶端接口,自動生成REST請求的實現
(5) 沒有你想象的復雜:AndroidAnnotations隻是在在編譯時生成相應子類
(6) 不影響應用性能:僅50kb,在編譯時完成,不會對運行時有性能影響。
PS:與roboguice的比較:roboguice通過運行時讀取annotations進行反射,所以可能影響應用性能,而AndroidAnnotations在編譯時生成子類,所以對性能沒有影響

roboguice 幫你處理瞭很多代碼異常,利用annotation使得更少的代碼完成項目
項目地址:https://github.com/roboguice/roboguice
文檔介紹:https://github.com/roboguice/roboguice/wiki

butterknife 利用annotation幫你快速完成View的初始化,減少代碼
項目地址:https://github.com/JakeWharton/butterknife
文檔介紹:https://jakewharton.github.io/butterknife/

Dagger 依賴註入,適用於Android和Java
項目地址:https://github.com/square/dagger
文檔介紹:https://square.github.io/dagger/

二、圖片緩存

  1. Android-Universal-Image-Loader 圖片緩存
    目前使用最廣泛的圖片緩存,支持主流圖片緩存的絕大多數特性。
    項目地址:https://github.com/nostra13/Android-Universal-Image-Loader
    Demo地址:https://github.com/Trinea/TrineaDownload/blob/master/universal-imageloader-demo.apk?raw=true
    文檔介紹:https://www.intexsoft.com/blog/item/74-universal-image-loader-part-3.html

    picasso square開源的圖片緩存
    項目地址:https://github.com/square/picasso
    文檔介紹:https://square.github.io/picasso/
    特點:(1)可以自動檢測adapter的重用並取消之前的下載
    (2)圖片變換
    (3)可以加載本地資源
    (4)可以設置占位資源
    (5)支持debug模式

    ImageCache 圖片緩存,包含內存和Sdcard緩存
    項目地址:https://github.com/Trinea/AndroidCommon
    Demo地址:https://play.google.com/store/apps/details?id=cn.trinea.android.demo
    文檔介紹:https://www.trinea.cn/?p=704
    特點:(1)支持預取新圖片,支持等待隊列
    (2)包含二級緩存,可自定義文件名保存規則
    (3)可選擇多種緩存算法(FIFO、LIFO、LRU、MRU、LFU、MFU等13種)或自定義緩存算法
    (4)可方便的保存及初始化恢復數據
    (5)支持不同類型網絡處理
    (6)可根據系統配置初始化緩存等

    三、網絡相關

    1. Asynchronous Http Client for Android Android異步Http請求
      項目地址:https://github.com/loopj/android-async-http
      文檔介紹:https://loopj.com/android-async-http/
      特點:(1) 在匿名回調中處理請求結果
      (2) 在UI線程外進行http請求
      (3) 文件斷點上傳
      (4) 智能重試
      (5) 默認gzip壓縮
      (6) 支持解析成Json格式
      (7) 可將Cookies持久化到SharedPreferences

      android-query 異步加載,更少代碼完成Android加載
      項目地址:https://github.com/androidquery/androidquery或https://code.google.com/p/android-query/
      文檔介紹:https://code.google.com/p/android-query/#Why_AQuery?
      Demo地址:https://play.google.com/store/apps/details?id=com.androidquery
      特點:https://code.google.com/p/android-query/#Why_AQuery?

      Async Http Client Java異步Http請求
      項目地址:https://github.com/AsyncHttpClient/async-http-client
      文檔介紹:https://sonatype.github.io/async-http-client/

      Ion 支持圖片、json、http post等異步請求
      項目地址:https://github.com/koush/ion
      文檔介紹:https://github.com/koush/ion#more-examples

      HttpCache Http緩存
      項目地址:https://github.com/Trinea/AndroidCommon
      Demo地址:https://play.google.com/store/apps/details?id=cn.trinea.android.demo
      Demo代碼:https://github.com/Trinea/AndroidDemo/blob/master/src/cn/trinea/android/demo/HttpCacheDemo.java
      特點是:(1) 根據cache-control、expires緩存http請求
      (2) 支持同步、異步Http請求
      (3) 在匿名回調中處理請求結果
      (4) 在UI線程外進行http請求
      (5) 默認gzip壓縮

      Http Request
      項目地址:https://github.com/kevinsawicki/http-request
      文檔介紹:https://github.com/kevinsawicki/http-request#examples

      okhttp square開源的http工具類
      項目地址:https://github.com/square/okhttp
      文檔介紹:https://square.github.io/okhttp/
      特點:(1) 支持SPDY(https://zh.wikipedia.org/wiki/SPDY)協議。SPDY協議是Google開發的基於傳輸控制協議的應用層協議,通過壓縮,多路復用(一個TCP鏈接傳送網頁和圖片等資源)和優先級來縮短加載時間。
      (2) 如果SPDY不可用,利用連接池減少請求延遲
      (3) Gzip壓縮
      (4) Response緩存減少不必要的請求

      Retrofit RESTFUL API設計
      項目地址:https://github.com/square/retrofit
      文檔介紹:https://square.github.io/retrofit/

      四、數據庫 orm工具包

      orm的db工具類,簡化建表、查詢、更新、插入、事務、索引的操作

      1. greenDAO Android Sqlite orm的db工具類
        項目地址:https://github.com/greenrobot/greenDAO
        文檔介紹:https://greendao-orm.com/documentation/
        官方網站:https://greendao-orm.com/
        特點:(1) 性能佳
        (2) 簡單易用的API
        (3) 內存小好小
        (4) 庫大小小

        ActiveAndroid Android Sqlite orm的db工具類
        項目地址:https://github.com/pardom/ActiveAndroid
        文檔介紹:https://github.com/pardom/ActiveAndroid/wiki/_pages

        Sprinkles Android Sqlite orm的db工具類
        項目地址:https://github.com/emilsjolander/sprinkles
        文檔介紹:https://emilsjolander.github.io/blog/2013/12/18/android-with-sprinkles/
        特點:比較顯著的特點就是配合https://github.com/square/retrofit能保存從服務器獲取的數據

        ormlite-android
        項目地址:https://github.com/j256/ormlite-android
        文檔介紹:https://ormlite.com/sqlite_java_android_orm.shtml

        五、Android公共庫

        1. Guava Google的基於java1.6的類庫集合的擴展項目
          包括collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O等等. 這些高質量的API可以使你的JAVa代碼更加優雅,更加簡潔
          項目地址:https://code.google.com/p/guava-libraries/
          文檔介紹:https://code.google.com/p/guava-libraries/wiki/GuavaExplained

          AndroidCommon Android公共庫
          項目地址:https://github.com/Trinea/AndroidCommon
          Demo地址:https://play.google.com/store/apps/details?id=cn.trinea.android.demo
          文檔介紹:https://www.trinea.cn/?p=778
          包括:(1)緩存(圖片緩存、預取緩存、網絡緩存)
          (2) 公共View(下拉及底部加載更多ListView、底部加載更多ScrollView、滑動一頁Gallery)
          (3) Android常用工具類(網絡、下載、Android資源操作、shell、文件、Json、隨機數、Collection等等)

          六、Android 高版本向低版本兼容

          1. ActionBarSherlock 為Android所有版本提供統一的ActionBar,解決4.0以下ActionBar的適配問題
            項目地址:https://github.com/JakeWharton/ActionBarSherlock
            Demo地址:https://play.google.com/store/apps/details?id=com.actionbarsherlock.sample.demos
            APP示例:太多瞭。。現在連google都在用

            Nine Old Androids 將Android 3.0(Honeycomb)所有動畫API(ObjectAnimator ValueAnimator等)兼容到Android1.0
            項目地址:https://github.com/JakeWharton/NineOldAndroids
            Demo地址:https://play.google.com/store/apps/details?id=com.jakewharton.nineoldandroids.sample
            文檔介紹:https://nineoldandroids.com/

            HoloEverywhere 將Android 3.0的Holo主題兼容到Android2.1++
            項目地址:https://github.com/Prototik/HoloEverywhere
            Demo地址:https://raw.github.com/Prototik/HoloEverywhere/repo/org/holoeverywhere/demo/2.1.0/demo-2.1.0.apk
            文檔介紹:https://android-developers.blogspot.com/2012/01/holo-everywhere.html

            七、多媒體相關

            1. cocos2d-x 跨平臺的2d遊戲框架,支持Android、IOS、Linux、Windows等眾多平臺
              項目地址:https://github.com/cocos2d/cocos2d-x
              文檔介紹:https://www.cocos2d-x.org/wiki
              官方網站:https://www.cocos2d-x.org/

              Vitamio 是一款Android與iOS平臺上的全能多媒體開發框架
              項目地址:https://github.com/yixia/VitamioBundle
              網站介紹:https://www.vitamio.org/docs/
              特點:(1) 全面支持硬件解碼與GPU渲染
              (2) 能夠流暢播放720P甚至1080P高清MKV,FLV,MP4,MOV,TS,RMVB等常見格式的視頻
              (3) 在Android與iOS上跨平臺支持 MMS, RTSP, RTMP, HLS(m3u8)等常見的多種視頻流媒體協議,包括點播與直播。

              PhotoProcessing 利用ndk處理圖片庫,支持Instafix、Ansel、Testino、XPro、Retro、BW、Sepia、Cyano、Georgia、Sahara、HDR、Rotate、Flip
              項目地址:https://github.com/lightbox/PhotoProcessing
              Demo地址:https://github.com/Trinea/TrineaDownload/blob/master/photo-processing.apk?raw=true

              Android StackBlur 圖片模糊效果工具類
              項目地址:https://github.com/kikoso/android-stackblur
              Demo地址:https://github.com/kikoso/android-stackblur/blob/master/StackBlurDemo/bin/StackBlurDemo.apk?raw=true
              文檔介紹:https://github.com/kikoso/android-stackblur#usage

              八、其他

              1. Salvage view 帶View緩存的Viewpager PagerAdapter,很方便使用
                項目地址:https://github.com/JakeWharton/salvage

                Android-PasscodeLock 應用鎖,每次啟動或從任何Activity啟動應用都需要輸入四位數字的密碼方可進入
                項目地址:https://github.com/wordpress-mobile/Android-PasscodeLock
                Demo地址:https://play.google.com/store/apps/details?id=com.sothree.umano
                APP示例:Wordpress Android,支付寶,挖財

                android-lockpattern Android的圖案密碼解鎖
                項目地址:https://code.google.com/p/android-lockpattern/
                Demo地址:https://play.google.com/store/apps/details?id=group.pals.android.lib.ui.lockpattern.demo
                使用介紹:https://code.google.com/p/android-lockpattern/wiki/QuickUse
                示例APP:Android開機的圖案密碼解鎖,支付寶的密碼解鎖

                GlowPadBackport將Android4.2的鎖屏界面解鎖擴展到Android1.6及1.6+
                項目地址:https://github.com/rock3r/GlowPadBackport
                Demo地址:https://play.google.com/store/apps/details?id=net.sebastianopoggi.samples.ui.GlowPadSample
                效果圖:Renderings

                GlowPadView Android4鎖屏界面解鎖
                項目地址:https://github.com/nadavfima/GlowPadView
                效果圖:Renderings

                Android Priority Job Queue Android後臺任務隊列
                項目地址:https://github.com/path/android-priority-jobqueue
                文檔介紹:https://github.com/path/android-priority-jobqueue#getting-started

                jsoup 一個解析html的java庫,可方便的提取和操作數據
                項目地址:https://github.com/jhy/jsoup
                官方網站:https://jsoup.org/
                作用:(1) 從一個url、文件或string獲得html並解析
                (2) 利用dom遍歷或css選擇器查找、提取數據
                (3) 操作html元素
                (4) 根據白名單去除用於提交的非法數據防止xss攻擊
                (5) 輸出整齊的html

                ZIP java壓縮和解壓庫
                項目地址:https://github.com/zeroturnaround/zt-zip
                文檔介紹:https://github.com/zeroturnaround/zt-zip#examples
                作用:(1) 解壓和壓縮,並支持文件夾內遞歸操作
                (2) 支持包含和排除某些元素
                (3) 支持重命名元素
                (4) 支持遍歷zip包內容
                (5) 比較兩個zip包等功能

                Cobub Razor 開源的mobile行為分析系統,包括web端、android端,支持ios和window phone
                項目地址:https://github.com/cobub/razor
                Demo地址:https://demo.cobub.com/razor
                網站介紹:https://dev.cobub.com/

                aFileChooser 文件選擇器,可內嵌到程序中,而無需使用系統或三方文件選擇器。
                項目地址:https://github.com/iPaulPro/aFileChooser

                androidpn 基於xmpp協議的消息推送解決方案,包括服務器端和android端。
                項目地址:https://github.com/dannytiehui/androidpn

                Android插件式開發
                項目地址:https://github.com/umeng/apf

    發佈留言

    發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *