Retrofit——下载

来源:互联网 发布:武汉茶港大院 知乎 编辑:程序博客网 时间:2024/06/18 10:30

今天讲Retrofit下载,包括jar形式、Maven形式、Gradle形式。另外,提供Retrofit的GitHub地址,再讲下Retrofit的混淆。


Retrofit jar下载及配置:

Retrofit 的jar(V2.3.0)下载地址,点这里。

Retrofit的Maven配置:

<dependency>  <groupId>com.squareup.retrofit2</groupId>  <artifactId>retrofit</artifactId>  <version>2.3.0</version></dependency>

Retrofit的Gradle配置:

compile 'com.squareup.retrofit2:retrofit:2.3.0'

Retrofit要求在java 7和android2.3以上运行。


Retrofit的Github地址:

https://github.com/square/retrofit



Retrofit混淆:

如果你在你的工程中使用ProGuard来混淆,你需要添加下面的这些配置。

# Platform calls Class.forName on types which do not exist on Android to determine platform.-dontnote retrofit2.Platform# Platform used when running on Java 8 VMs. Will not be used at runtime.-dontwarn retrofit2.Platform$Java8# Retain generic type information for use by reflection by converters and adapters.-keepattributes Signature# Retain declared checked exceptions for use by a Proxy instance.-keepattributes Exceptions

Retrofit使用OKio作为网络请求引擎,因此,你还需要了解它的ProGuard规则。见参考网址:

https://github.com/square/okio#proguard