Skip to content

Commit 4c35655

Browse files
committed
版本升级至2.2.4
1 parent a84ab6d commit 4c35655

3 files changed

Lines changed: 48 additions & 34 deletions

File tree

README.md

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,25 @@
2424

2525
```java
2626
//以下三个为必须,其它均为非必须
27-
implementation 'com.ljx.rxhttp:rxhttp:2.2.3'
28-
implementation 'com.squareup.okhttp3:okhttp:4.6.0' //rxhttp v2.2.2版本起,需要手动依赖okhttp
29-
annotationProcessor 'com.ljx.rxhttp:rxhttp-compiler:2.2.3' //生成RxHttp类,kotlin用户,请使用kapt替代annotationProcessor
27+
implementation 'com.ljx.rxhttp:rxhttp:2.2.4'
28+
implementation 'com.squareup.okhttp3:okhttp:4.7.2' //rxhttp v2.2.2版本起,需要手动依赖okhttp
29+
annotationProcessor 'com.ljx.rxhttp:rxhttp-compiler:2.2.4' //生成RxHttp类,kotlin用户,请使用kapt替代annotationProcessor
3030

3131
implementation 'com.ljx.rxlife:rxlife-coroutine:2.0.0' //管理协程生命周期,页面销毁,关闭请求
3232
implementation 'com.ljx.rxlife2:rxlife-rxjava:2.0.0' //管理RxJava2生命周期,页面销毁,关闭请求
3333
implementation 'com.ljx.rxlife3:rxlife-rxjava:3.0.0' //管理RxJava3生命周期,页面销毁,关闭请求
3434

3535
//Converter 根据自己需求选择 RxHttp默认内置了GsonConverter
36-
implementation 'com.ljx.rxhttp:converter-jackson:2.2.3'
37-
implementation 'com.ljx.rxhttp:converter-fastjson:2.2.3'
38-
implementation 'com.ljx.rxhttp:converter-protobuf:2.2.3'
39-
implementation 'com.ljx.rxhttp:converter-simplexml:2.2.3'
36+
implementation 'com.ljx.rxhttp:converter-jackson:2.2.4'
37+
implementation 'com.ljx.rxhttp:converter-fastjson:2.2.4'
38+
implementation 'com.ljx.rxhttp:converter-protobuf:2.2.4'
39+
implementation 'com.ljx.rxhttp:converter-simplexml:2.2.4'
4040
```
4141
[遇到问题,点击这里,99%的问题都能自己解决](https://github.com/liujingxing/okhttp-RxHttp/wiki/FAQ)
4242

4343
***RxHttp&RxLife 交流群:378530627***
4444

45-
# 准备工作
45+
# 上手准备(必看)
4646

4747
1、RxHttp 要求项目使用Java 8 或更高版本,请在 app 的 build.gradle 添加以下代码
4848

@@ -53,7 +53,30 @@ compileOptions {
5353
}
5454
```
5555

56-
2、RxHttp 2.2.0版本起,内部不在依赖RxJava相关库,采用外挂的方法替代,如你需要结合RxJava发送请求,请单独配置,如下:
56+
2、OkHttp兼容问题
57+
58+
RxHttp目前对OkHttp 的 `v3.12.0 - v4.7.x`均已完成适配工作(v4.3.0除外,该版本有一bug,暂时无法适配),
59+
在你依赖okhttp时,需要告诉rxhttp你依赖的okhttp版本号,如下:
60+
61+
```java
62+
defaultConfig {
63+
javaCompileOptions {
64+
annotationProcessorOptions {
65+
//告知RxHttp你依赖的okhttp版本
66+
arguments = [rxhttp_okhttp: '4.7.2'] //可传入3.12.x至4.7.x任一版本(4.3.0除外)
67+
}
68+
}
69+
}
70+
dependencies {
71+
implementation 'com.squareup.okhttp3:okhttp:4.7.2'
72+
}
73+
```
74+
75+
***注:`OkHttp 3.14.x`以上版本, 最低要求为API 21,如你想要兼容21以下,请依赖`OkHttp 3.12.x`,该版本最低要求 API 9***
76+
77+
3、RxJava兼容问题
78+
79+
RxHttp 2.2.0版本起,内部不在依赖RxJava相关库,采用外挂的方法替代,如你需要结合RxJava发送请求,请单独配置,如下:
5780

5881
```java
5982
defaultConfig {
@@ -78,27 +101,18 @@ dependencies {
78101
}
79102
```
80103

81-
最后,***rebuild一下(此步骤是必须的)*** ,就会自动生成RxHttp类,到这,准备工作完毕。
82-
83-
# API兼容
84-
85-
RxHttp最低要求为API 15,但是由于`OkHttp 3.14.x`以上版本, 最低要求为API 21,
86-
如果你想要兼容到API 15,请依赖`OkHttp 3.12.x` 版本,并告知rxhttp你依赖的okhttp版本,如下:
87-
104+
***注: 如你需要同时指定okhttp及rxjava版本,只需用逗号隔开即可,如下:***
88105
```java
89-
defaultConfig {
90-
javaCompileOptions {
91-
annotationProcessorOptions {
92-
//如你依赖的okhttp并非最新版本,都需要告知RxHttp你依赖的okhttp版本
93-
arguments = [rxhttp_okhttp: '3.12.6'] //可传入3.12.0至4.6.0任一版本(4.3.0除外)
94-
}
95-
}
96-
}
97-
dependencies {
98-
implementation 'com.squareup.okhttp3:okhttp:3.12.6' //此版本最低要求 API 9
106+
annotationProcessorOptions {
107+
arguments = [
108+
rxhttp_okhttp: '4.7.2',
109+
rxhttp_rxjava: 'rxjava3'
110+
]
99111
}
100112
```
101-
***注:RxHttp目前对OkHttp 的 `v3.12.0 - v4.6.0`均已完成适配工作(v4.3.0除外,该版本有一bug,暂时无法适配)***
113+
114+
最后,***rebuild一下(此步骤是必须的)*** ,就会自动生成RxHttp类,到这,准备工作完毕。
115+
102116

103117
# 上手教程
104118

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ dependencies {
5252
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
5353
implementation 'com.github.hackware1993:MagicIndicator:1.6.0'
5454

55-
implementation project(":rxhttp")
56-
kapt project(':rxhttp-compiler')
55+
// implementation project(":rxhttp")
56+
// kapt project(':rxhttp-compiler')
5757

5858
implementation "com.squareup.okhttp3:okhttp:${okhttp_version}"
5959

60-
// implementation "com.ljx.rxhttp:rxhttp:${rxhttp_version}"
61-
// kapt "com.ljx.rxhttp:rxhttp-compiler:${rxhttp_version}"
60+
implementation "com.ljx.rxhttp:rxhttp:${rxhttp_version}"
61+
kapt "com.ljx.rxhttp:rxhttp-compiler:${rxhttp_version}"
6262

6363
implementation 'com.ljx.rxlife:rxlife-coroutine:2.0.0'
6464

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ org.gradle.jvmargs=-Xmx1536m
1919

2020
okhttp_version=4.7.2
2121

22-
rxhttp_version=2.2.3
23-
rxhttp_next_version=2.2.4
24-
rxhttp_converter_version=2.2.3
22+
rxhttp_version=2.2.4
23+
rxhttp_next_version=2.2.5
24+
rxhttp_converter_version=2.2.4

0 commit comments

Comments
 (0)