Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZhousf committed Feb 6, 2018
1 parent 85db889 commit 0d5fda1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@
<dependency>
<groupId>com.zhousf.lib</groupId>
<artifactId>okhttp3</artifactId>
<version>2.9.5.5</version>
<version>2.9.6</version>
<type>pom</type>
</dependency>
```
### Gradle
```
compile 'com.zhousf.lib:okhttp3:2.9.5.5'
compile 'com.zhousf.lib:okhttp3:2.9.6'
```
若项目已包含support-annotations或出现support-annotations版本冲突请采用下面方式进行依赖:
```
compile ('com.zhousf.lib:okhttp3:2.9.5.5'){
compile ('com.zhousf.lib:okhttp3:2.9.6'){
exclude(module: 'support-annotations')
}
```
若项目已包含Gson或出现Gson版本冲突请采用下面方式进行依赖:
```
compile ('com.zhousf.lib:okhttp3:2.9.5.5'){
compile ('com.zhousf.lib:okhttp3:2.9.6'){
exclude(module:'gson')
}
```
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {

dependencies {
compile project(':okhttp3')
// compile ('com.zhousf.lib:okhttp3:2.9.5.5'){
// compile ('com.zhousf.lib:okhttp3:2.9.6'){
// exclude(module:'gson')
// }
compile fileTree(include: ['*.jar'], dir: 'libs')
Expand Down
2 changes: 1 addition & 1 deletion okhttp3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
targetSdkVersion rootProject.sdkVersion
minSdkVersion rootProject.minSdkVersion
versionCode 1
versionName "2.9.5.5"
versionName "2.9.6"
}

buildTypes {
Expand Down
6 changes: 6 additions & 0 deletions okhttp3/src/main/java/com/okhttplib/OkHttpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,12 @@ private OkHttpUtil(Builder builder) {
.helperInfo(packageHelperInfo(null))
.build();
}
if(httpClient == null){
OkHttpHelper.Builder()
.helperInfo(packageHelperInfo(null))
.build()
.doRequestAsync();
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions okhttp3/src/main/java/com/okhttplib/helper/BaseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ abstract class BaseHelper {
if(null == defaultClient){
httpClient = initHttpClient(helperInfo);
helperInfo.getOkHttpUtil().setDefaultClient(httpClient);
}else{
}else{
httpClient = defaultClient;
}
}
}else{
httpClient = initHttpClient(helperInfo);
}
Expand Down
2 changes: 2 additions & 0 deletions okhttp3/src/main/java/com/okhttplib/helper/HttpHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ HttpInfo doRequestSync(OkHttpHelper helper){
* 异步请求
*/
void doRequestAsync(final OkHttpHelper helper){
if(httpInfo == null)
return ;
final HttpInfo info = httpInfo;
final BaseCallback callback = helper.getCallback();
Request request = helper.getRequest();
Expand Down

0 comments on commit 0d5fda1

Please sign in to comment.