当前位置:嗨网首页>书籍在线阅读

07-添加项目库依赖

  
选择背景色: 黄橙 洋红 淡粉 水蓝 草绿 白色 选择字体: 宋体 黑体 微软雅黑 楷体 选择字体大小: 恢复默认

18.3.2 添加项目库依赖

在Android项目开发中,除了新建项目时系统默认添加的依赖库之外,还需要使用大量的第三方库,如OKHttp、Glide和Gson等,合理地使用第三方库不仅可以加快项目的开发速度,还可以提高代码的质量并减少代码的复杂度。

在本视频播放器示例项目中,除了系统提供的默认依赖库之外,还需要添加以下这些第三方依赖库,这些库位于app/build.gradle文件中。

implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'io.reactivex.rxjava2:rxjava:2.1.8'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.shuyu:GSYVideoPlayer:4.1.1'
implementation 'com.google.android:flexbox:0.3.1'
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'
implementation('com.flyco.tablayout:FlycoTabLayout_Lib:2.1.0@aar') {
   exclude group: 'com.android.support', module: 'support-v4'
}

需要注意的是,在包的依赖方式上,compile方式将逐步被implementation方式所替换。