如何解决FATAL EXCEPTION:pool-4-thread-1错误?

时间:2016-05-01 08:19:56

标签: android web-services

我有一个非常好用的应用程序,但有时当我向我的程序添加一些类和代码时,我的应用程序崩溃了。我的logcat错误就是:

FATAL EXCEPTION: pool-4-thread-1

在我的代码中是这样的:

reader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream(),"UTF-8"));

为此,我无法改进我的应用程序。

我的logcat:

8871-8929/com.example.first E/AndroidRuntime﹕ FATAL EXCEPTION: pool-4-thread-1
java.lang.NoClassDefFoundError: okio.Okio
        at com.squareup.okhttp.internal.http.HttpConnection.<init>(HttpConnection.java:90)
        at com.squareup.okhttp.Connection.connectSocket(Connection.java:208)
        at com.squareup.okhttp.Connection.connect(Connection.java:172)
        at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:367)
        at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
        at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:328)
        at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:245)
        at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:438)
        at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:389)
        at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:233)

的build.gradle:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.1.+'
compile 'com.google.android.gms:play-services:3.2.+'
compile 'net.hockeyapp.android:HockeySDK:3.6.+'
compile 'com.googlecode.mp4parser:isoparser:1.0.+'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.github.bumptech.glide:glide:+'
compile 'com.nineoldandroids:library:2.4.+'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
compile 'com.theartofdev.edmodo:android-image-cropper:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
compile 'com.github.rahatarmanahmed:circularprogressview:2.4.0'
compile 'com.makeramen:roundedimageview:2.1.2'
compile 'com.squareup.okio:okio:1.6.0'
}

1 个答案:

答案 0 :(得分:0)

OkHttp需要Okio,OkHttp用于快速I / O和可调整大小的缓冲区。您可以下载Okio(最新的JAR)here

Android gradle:编译'com.squareup.okio:okio:1.6.0'

来自https://github.com/square/okhttp/issues/870

的参考资料