android开发收集的第三方框架和库

来源:互联网 发布:js修改input边框颜色 编辑:程序博客网 时间:2024/06/07 02:11

主要介绍一下开发中会采用的库第三方框架和库

  1. Retrofit  

一句话介绍:Retrofit是一款类型安全的网络框架,基于HTTP协议,服务于Android和java语言

官网地址 http://square.github.io/retrofit/

github https://github.com/square/retrofit

作者:square团队

使用:

compile ‘com.squareup.retrofit2:retrofit:2.3.0’

2.okhttp
一句话介绍:okhttp是一款基于HTTP和HTTP2.0协议的网络框架,服务于java和android客户端

上榜理由,okhttp以20.4k的stars量雄踞github中android子标题第二名。大型公司比如淘宝也封装的是okhttp。Retrofit2.0开始内置okhttp框架,Retrofit专注封装接口完成业务需求,okhttp专注网络请求的安全高效,笔者将两者区分开,是想让后来学习者知道,这是两套框架,学习框架原理时可以分开学习,以免理解混乱。

官网地址 http://square.github.io/okhttp/

github https://github.com/square/okhttp

作者:square团队

使用:

compile ‘com.squareup.okhttp3:okhttp:3.8.0’

3.Butter Knife
一句话介绍:Butter Knife所提供了一种能力——使用注解生成模板代码,将view与方法和参数绑定。

上榜理由:github上16.5K个star,配合Androidstudio提供的Butter Knife插件,帮助开发者省却了频繁findviewbyid的烦恼,最新的Butter Knife还提供了onclick绑定以及字符串的初始化,初学者可以查阅Butter Knife以及Butter Knife插件进一步学习!

官网地址:http://jakewharton.github.io/butterknife/

github:https://github.com/JakeWharton/butterknife

作者:JakeWharton ,也是square团队成员之一

使用:

dependencies {
compile ‘com.jakewharton:butterknife:8.6.0’
annotationProcessor ‘com.jakewharton:butterknife-compiler:8.6.0’
}

4.MPAndroidChart
一句话介绍:MPAndroidChart是一款图表框架

上榜理由:github上16.1K个star,以快速、简洁。强大著称的图表框架

官网地址 https://github.com/PhilJay/MPAndroidChart

github https://github.com/PhilJay/MPAndroidChart

作者:PhilJay

使用:

  1. 在AS中加入Gradle依赖

在根目录的 build.gradle上加入:
allprojects {
repositories {
maven { url “https://jitpack.io” }
}
}

在app的build.gradle上加入:
dependencies {
compile ‘com.github.PhilJay:MPAndroidChart:v3.0.2’
}

  1. glide
    一句话介绍:glide是一款专注于提供流畅划动能力的“图片加载和缓存框架”

上榜理由:15.9k个star,图片加载类框架排名第一的框架,google 在2014开发者大会上演示的camera app就是基于gilde框架开发的

github https://github.com/bumptech/glide

作者 Bump Technologies团队

使用:

复制代码
repositories {
mavenCentral()
}

dependencies {
compile ‘com.github.bumptech.glide:glide:3.8.0’
compile ‘com.android.support:support-v4:19.1.0’
}
复制代码
6.leakcanary
一句话介绍:一款内存检测框架,服务于java和android客户端

上榜理由:方便,简洁是leakcanary最大的特点,只需在应用的apllication中集成,就可以直接使用它;15.5k个star说明了它有多么受欢迎

github https://github.com/square/leakcanary

作者 square团队

使用:

dependencies {
debugCompile ‘com.squareup.leakcanary:leakcanary-android:1.5.1’
releaseCompile ‘com.squareup.leakcanary:leakcanary-android-no-op:1.5.1’
testCompile ‘com.squareup.leakcanary:leakcanary-android-no-op:1.5.1’
}
在 Application 中写入:

复制代码
public class ExampleApplication extends Application {

@Override public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
LeakCanary.install(this);
// Normal app init code…
}
}
复制代码

7.Android-Universal-Image-Loader
一句话介绍:曾经的图片加载框架王者,android开发老手都用过它

上榜理由:android端图片加载框架的老大哥了,15.3k个star足以证明它的热门,UIL与gilde最大区别是可定制,UIL提供了大量配置方式,图片加载状态的回调(成功,失败,进行中),加载动画等;以及提供了移动端图片加载框架的缓存思路:三级缓存策略 sd卡-内存-网络;值得注意的是,UIL以及两年未更新了,但笔者仍推荐各位使用!

github https://github.com/nostra13/Android-Universal-Image-Loader

作者 nostra13

使用:

下载地址 universal-image-loader-1.9.5.jar

8.EventBus
一句话介绍:EventBus是一款本地组件间通信框架

上榜理由:组件间通信框架star量第一:14.8k,在大型项目的Activities,fragments,Threads,Services都可以看到它的使用场景,尽管EventBus在向未创建的组件传递事件时有些局限,仅适合在“活着的”组件间传递消息,但仍不妨碍它活跃在各个大型项目各个场景里。

官网地址 http://greenrobot.org/eventbus/documentation/how-to-get-started/

github https://github.com/greenrobot/EventBus

作者 greenrobot

使用:

compile ‘org.greenrobot:eventbus:3.0.0’

9.zxing
一句话介绍:条码图像处理库

上榜理由:如果你用过二维码,你肯定已经间接使用过大名鼎鼎的zxing了。13.9K的star量,让它排在本榜单第九,实至名归,如果你有了解二维码的需求,不妨从了解、修改它源码入手。

github https://github.com/zxing/zxing

作者 Sean Owen

10.picasso
一句话介绍:强力的图片下载、缓存框架

上榜理由:本榜单出现的第三款图片类框架,不同的是picasso更强调图片下载,你可以将picasso集成进你的项目中,你也可以结合gilde和UIL与picasso,三者一齐封装至你的项目中,按需所用。

官网地址 http://square.github.io/picasso/

github https://github.com/square/picasso

作者 square团队

使用:

compile ‘com.squareup.picasso:picasso:2.5.2’
或者下载

jar包

11.lottie-android
一句话介绍:一款可以在Android端快速展示Adobe Afeter Effect(AE)工具所作动画的框架

上榜理由:动画类框架第一名,github上13.3k个star证明了他的优越性,利用json文件快速实现动画效果是它最大的便利,而这个json文件也是由Adobe提供的After Effects(AE)工具制作的,在AE中装一个Bodymovin的插件,使用这个插件最终将动画效果生成json文件,这个json文件即可由LottieAnimationView解析并生成绚丽的动画效果。而且它还支持跨平台哟。

github https://github.com/airbnb/lottie-android

作者:Airbnb 团队

12.fresco
一句话介绍:一款可以管理图片内存的框架

上榜理由:github上12.8k个star,图片类排行榜第四名,facebook的出身证明了它并非是重复造的轮子,在管理图片内存领域上有着它的一片天地,渐进式加载、加载gif都是它与前三位相比独有的特性

官网地址: https://www.fresco-cn.org/

github https://github.com/facebook/fresco

作者 facebook

使用:

dependencies {
// 其他依赖
compile ‘com.facebook.fresco:fresco:0.12.0’
}
下面的依赖需要根据需求添加:

复制代码
dependencies {
// 在 API < 14 上的机器支持 WebP 时,需要添加
compile ‘com.facebook.fresco:animated-base-support:0.12.0’

// 支持 GIF 动图,需要添加
compile ‘com.facebook.fresco:animated-gif:0.12.0’

// 支持 WebP (静态图+动图),需要添加
compile ‘com.facebook.fresco:animated-webp:0.12.0’
compile ‘com.facebook.fresco:webpsupport:0.12.0’

// 仅支持 WebP 静态图,需要添加
compile ‘com.facebook.fresco:webpsupport:0.12.0’
}
复制代码

13.RxAndroid
一句话介绍:一款Android客户端组件间异步通信的框架

上榜理由:github上12.7k个star,位居组件通信框架的第二名,仅在EventBus之后,如果要问两者的区别,Eventbus是用来取代组件间繁琐的interface,RxAndroid是用来取代AnsyTask的,并不冲突;当然RxAndroid的优点并不仅限于此,更多优雅的实现,可以去官网查阅!

github https://github.com/ReactiveX/RxAndroid

作者 JakeWharton

使用:

compile ‘io.reactivex.rxjava2:rxandroid:2.0.1’
compile ‘io.reactivex.rxjava2:rxjava:2.1.0’

14.SlidingMenu
一句话介绍:侧滑菜单栏框架

上榜理由:与Userval-Image-loader 齐名的上古神器框架——为你的app提供侧滑菜单栏的功能;github闪更有10.5k个star,证明了它的经久不衰,即使在Google推出了NavigationDrawer,仍然没有减少开发者对SildingMenu的拥簇,经典总是经得起考验的,这个上古神兽已经四年没有更新了;有太多太多的app使用过它,这些都可以在软件的开源许可上看到!

github https://github.com/jfeinstein10/SlidingMenu

作者 Jeremy Feinstein

使用:

在gihub上fork源码,集成进项目中

15.PhotoView
一句话介绍:一款ImageView展示框架,支持缩放,响应手势

上榜理由:10.3k的star数量,位于图片类框架排行榜第五位,PhotoView与前四位不同的是这次带来的是图片的展示能力,你一定好奇微信的头像点击放大是如何实现的,很多App的图片显示响应手势按压是如何实现的,了解PhotoView,你一定会开心的!(笔者也不会告诉你ImageView的点击放大效果在Android的sample也有)

github https://github.com/chrisbanes/PhotoView

作者:chrisbanes

使用:

复制代码
在app根目录的build.gradle中加入:
allprojects {
repositories {
maven { url “https://jitpack.io” }
}
}
在app的module目录的build.gralde中加入:

dependencies {
compile ‘com.github.chrisbanes:PhotoView:latest.release.here’
}
复制代码
使用

复制代码


apply plugin: ‘com.android.application’
apply plugin: ‘org.greenrobot.greendao’ // apply plugin

dependencies {
compile ‘org.greenrobot:greendao:3.2.2’ // add library
}
复制代码

29.stetho
一句话介绍:一款提供在Chrome开发者工具上调试Android app能力的开源框架

上榜理由:上古时期Android程序员要调试本地数据库,需要进入Android Device Monitor找到/data/data/com.xxx.xxx/databases里面的db文件,导出到PC端,用PC的数据工具查看,现在使用stetho省却了如此的麻烦;如今的Android程序员如果想调试网络请求响应过程中的报文段,需要在请求中加入Log语句,一个信息一个信息打印出来,相当繁琐,现在请使用stetho,省却诸如此类的麻烦把!7.8K个star数,广大Android开发者调试的福音,你值得拥有!

作者:FaceBook

官网地址: http://facebook.github.io/stetho/

github https://github.com/facebook/stetho

使用:

compile ‘com.facebook.stetho:stetho:1.5.0’

30.BaseRecyclerViewAdapterHelper
一句话介绍:强大、流畅的Recyvlerview通用适配器

上榜理由:如果你是RecyclerView的拥簇者,你一定要体验这款专门服务该view的适配器,7.7K个star,让这个家伙位于github上Android 适配器排行榜第一,还有很多惊喜等你去探寻!

官网地址:http://www.recyclerview.org/

作者:陈宇明以及他的小伙伴

使用:

复制代码
allprojects {
repositories {

maven { url “https://jitpack.io” }
}
}

dependencies {
compile ‘com.github.CymChad:BaseRecyclerViewAdapterHelper:VERSION_CODE’
}
复制代码

31.AndroidViewAnimations
一句话介绍:一款提供可爱动画集合的框架

上榜理由:正如作者所说,它囊括了开发需求过程中所有的动画效果,集成进了这个简洁可爱的动画框架。7.6K的star数,证明了它在动画框架领域的战斗力,让它仅仅位列lottie-android和Material-Animations两个动画框架霸主之后,屈居第三名

github https://github.com/daimajia/AndroidViewAnimations

作者:daimajia

使用:

dependencies {
compile ‘com.android.support:support-compat:25.1.1’
compile ‘com.daimajia.easing:library:2.0@aar’
compile ‘com.daimajia.androidanimations:library:2.2@aar’
}
sample:

YoYo.with(Techniques.Tada)
.duration(700)
.repeat(5)
.playOn(findViewById(R.id.edit_area));

  1. MaterialDrawer
    一句话介绍:强大的塑料风格的抽屉框架

上榜理由:7.6K的star数量,作者的持续更新状态,如果你还在犹豫上手SlidingMenu遇到bug没人管的困境,那么你可以入手它作为你的抽屉布局

github https://github.com/mikepenz/MaterialDrawer

作者:Mike Penz

使用:

compile(‘com.mikepenz:materialdrawer:5.9.2@aar’) {
transitive = true
}

new DrawerBuilder().withActivity(this).build();

33.Android-ObservableScrollView
一句话介绍:一款让视图滑动更具有视觉效果的滑动式框架

上榜理由:7.5K的star数量,证明了它曾经的价值,github上提供了12种滑动效果,你可以用它弥补其他框架的不足,提升你的App体验!

github https://github.com/ksoichiro/Android-ObservableScrollView

作者:Soichiro Kashima

使用:

compile com.github.ksoichiro:android-observablescrollview

34.CircleImageView
一句话介绍:圆角ImageView

上榜理由:也许你已经听说过无数种展示圆角图片的方法,但如果你不尝试尝试CircleImageView,那么你的知识库会因为少了它黯然失色,有的时候完成需求是开发者优先考虑的,不同实现方法牵扯到的性能差异更值得让人深思,如果你有心在图片性能上有所涉猎,那么CircleImageView绝对不会让你败兴而归。最后别忘了记得去看Romain Guy的建议哟。

github https://github.com/hdodenhof/CircleImageView

作者:Henning Dodenhof

使用:

dependencies {

compile ‘de.hdodenhof:circleimageview:2.1.0’
}

复制代码

原创粉丝点击