Skip to content

Commit e44b87a

Browse files
authored
Update README.md
1 parent 8d0284b commit e44b87a

File tree

1 file changed

+109
-34
lines changed

1 file changed

+109
-34
lines changed

README.md

Lines changed: 109 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,72 +23,147 @@ A type-safe HTTP client for Android. Written based on OkHttp
2323

2424
### Required
2525

26-
Add it to your build.gradle with:
26+
<details>
27+
<summary>1、Add jitpack to your build.gradle</summary>
28+
2729
```java
2830
allprojects {
2931
repositories {
3032
maven { url "https://jitpack.io" }
3133
}
3234
}
3335
```
34-
and:
35-
36+
</details>
37+
<details>
38+
<summary>2、Java 8 or higher</summary>
39+
3640
```java
37-
//Must be used when using kapt
38-
apply plugin: 'kotlin-kapt'
39-
4041
android {
41-
//Java 8 or higher
4242
compileOptions {
4343
sourceCompatibility JavaVersion.VERSION_1_8
4444
targetCompatibility JavaVersion.VERSION_1_8
4545
}
4646
}
47-
47+
```
48+
</details>
49+
<details open>
50+
<summary>3、Add RxHttp dependency</summary>
51+
52+
```java
53+
//Must be used when using kapt
54+
apply plugin: 'kotlin-kapt'
4855
dependencies {
49-
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
56+
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
5057
implementation 'com.github.liujingxing.rxhttp:rxhttp:2.7.0'
5158
//Use the annotationProcessor instead of kapt, if you use Java
52-
kapt 'com.github.liujingxing.rxhttp:rxhttp-compiler:2.7.0'
59+
kapt 'com.github.liujingxing.rxhttp:rxhttp-compiler:2.7.0'
5360
}
5461
```
62+
</details>
5563

5664
### Optional
65+
66+
### 1、Coverter
67+
```java
68+
implementation 'com.github.liujingxing.rxhttp:converter-fastjson:2.7.0'
69+
implementation 'com.github.liujingxing.rxhttp:converter-jackson:2.7.0'
70+
implementation 'com.github.liujingxing.rxhttp:converter-moshi:2.7.0'
71+
implementation 'com.github.liujingxing.rxhttp:converter-protobuf:2.7.0'
72+
implementation 'com.github.liujingxing.rxhttp:converter-simplexml:2.7.0'
73+
```
74+
75+
### 2、RxJava
76+
<details open>
77+
<summary>RxHttp + RxJava3</summary>
78+
79+
```java
80+
implementation 'io.reactivex.rxjava3:rxjava:3.1.1'
81+
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
82+
implementation 'com.github.liujingxing.rxlife:rxlife-rxjava3:2.2.1' //RxJava3, Automatic close request
83+
```
84+
85+
</details>
86+
<details>
87+
<summary>RxHttp + RxJava2</summary>
88+
89+
```java
90+
implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
91+
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
92+
implementation 'com.github.liujingxing.rxlife:rxlife-rxjava2:2.2.1' //RxJava2, Automatic close request
93+
```
94+
</details>
95+
<details open>
96+
<summary>Kapt passes the RxJava version</summary>
97+
5798
```java
5899
android {
59100
kapt {
60101
arguments {
61-
//Pass in the RxJava version name if you use RxJava
62102
arg("rxhttp_rxjava", "3.1.1")
63-
arg("rxhttp_package", "rxhttp") //Specifies the RxHttp class package
64103
}
65104
}
66-
//If you uses Java, pass the parameters using javaCompileOptions in defaultConfig
67-
annotationProcessorOptions {
68-
arguments = [
69-
rxhttp_rxjava: '3.1.1',
70-
rxhttp_package: 'rxhttp'
71-
]
105+
}
106+
```
107+
108+
</details>
109+
110+
<details>
111+
<summary>javaCompileOptions passes the RxJava version</summary>
112+
113+
```java
114+
android {
115+
defaultConfig {
116+
javaCompileOptions {
117+
annotationProcessorOptions {
118+
arguments = [
119+
rxhttp_rxjava: '3.1.1',
120+
]
121+
}
122+
}
72123
}
73124
}
74-
dependencies {
75-
//rxjava2 (RxJava2/Rxjava3 select one)
76-
implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
77-
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
78-
implementation 'com.github.liujingxing.rxlife:rxlife-rxjava2:2.2.1' //RxJava2, Automatic close request
79-
80-
//rxjava3
81-
implementation 'io.reactivex.rxjava3:rxjava:3.1.1'
82-
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
83-
implementation 'com.github.liujingxing.rxlife:rxlife-rxjava3:2.2.1' //RxJava3, Automatic close request
84-
85-
implementation 'com.github.liujingxing.rxhttp:converter-fastjson:2.7.0'
86-
implementation 'com.github.liujingxing.rxhttp:converter-jackson:2.7.0'
87-
implementation 'com.github.liujingxing.rxhttp:converter-moshi:2.7.0'
88-
implementation 'com.github.liujingxing.rxhttp:converter-protobuf:2.7.0'
89-
implementation 'com.github.liujingxing.rxhttp:converter-simplexml:2.7.0'
125+
```
126+
127+
</details>
128+
129+
`kapt/javaCompileOptions select one,With Kapt, if you integrate kotlin`
130+
131+
### 3、set RxHttp class package name
132+
<details open>
133+
<summary>kapt pass package name</summary>
134+
135+
```java
136+
android {
137+
kapt {
138+
arguments {
139+
arg("rxhttp_package", "rxhttp.xxx")
140+
}
141+
}
90142
}
91143
```
144+
145+
</details>
146+
147+
<details>
148+
<summary>javaCompileOptions pass package name</summary>
149+
150+
```java
151+
android {
152+
defaultConfig {
153+
javaCompileOptions {
154+
annotationProcessorOptions {
155+
arguments = [
156+
rxhttp_package: 'rxhttp.xxx'
157+
]
158+
}
159+
}
160+
}
161+
}
162+
```
163+
</details>
164+
165+
`kapt/javaCompileOptions select one,With Kapt, if you integrate kotlin`
166+
92167

93168
**Finally, rebuild the project, which is necessary**
94169

0 commit comments

Comments
 (0)