@@ -23,72 +23,147 @@ A type-safe HTTP client for Android. Written based on OkHttp
23
23
24
24
### Required
25
25
26
- Add it to your build.gradle with:
26
+ <details >
27
+ <summary >1、Add jitpack to your build.gradle</summary >
28
+
27
29
``` java
28
30
allprojects {
29
31
repositories {
30
32
maven { url " https://jitpack.io" }
31
33
}
32
34
}
33
35
```
34
- and:
35
-
36
+ </details >
37
+ <details >
38
+ <summary >2、Java 8 or higher</summary >
39
+
36
40
``` java
37
- // Must be used when using kapt
38
- apply plugin: ' kotlin-kapt'
39
-
40
41
android {
41
- // Java 8 or higher
42
42
compileOptions {
43
43
sourceCompatibility JavaVersion . VERSION_1_8
44
44
targetCompatibility JavaVersion . VERSION_1_8
45
45
}
46
46
}
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'
48
55
dependencies {
49
- implementation ' com.squareup.okhttp3:okhttp:4.9.1'
56
+ implementation ' com.squareup.okhttp3:okhttp:4.9.1'
50
57
implementation ' com.github.liujingxing.rxhttp:rxhttp:2.7.0'
51
58
// 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'
53
60
}
54
61
```
62
+ </details >
55
63
56
64
### 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
+
57
98
``` java
58
99
android {
59
100
kapt {
60
101
arguments {
61
- // Pass in the RxJava version name if you use RxJava
62
102
arg(" rxhttp_rxjava" , " 3.1.1" )
63
- arg(" rxhttp_package" , " rxhttp" ) // Specifies the RxHttp class package
64
103
}
65
104
}
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
+ }
72
123
}
73
124
}
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
+ }
90
142
}
91
143
```
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
+
92
167
93
168
** Finally, rebuild the project, which is necessary**
94
169
0 commit comments