2016-08-18 75 views
0
application interceptor [email protected] returned null 

當我用OkHttp3,這個錯誤發生一個NullPointerException很多次!尤其是沒有網絡。應用攔截[email protected]返回null

下面是詳細信息:

enter image description here

這裏是哪裏發生錯誤的資源代碼:

class ApplicationInterceptorChain implements Interceptor.Chain { 
private final int index; 
private final Request request; 
private final boolean forWebSocket; 

ApplicationInterceptorChain(int index, Request request, boolean forWebSocket) { 
    this.index = index; 
    this.request = request; 
    this.forWebSocket = forWebSocket; 
} 

@Override public Connection connection() { 
    return null; 
} 

@Override public Request request() { 
    return request; 
} 

@Override public Response proceed(Request request) throws IOException { 
    // If there's another interceptor in the chain, call that. 
    if (index < client.interceptors().size()) { 
    Interceptor.Chain chain = new ApplicationInterceptorChain(index + 1, request, forWebSocket); 
    Interceptor interceptor = client.interceptors().get(index); 
    Response interceptedResponse = interceptor.intercept(chain); 

    if (interceptedResponse == null) { 
     throw new NullPointerException("application interceptor " + interceptor 
      + " returned null"); 
    } 

    return interceptedResponse; 
    } 

    // No more interceptors. Do HTTP. 
    return getResponse(request, forWebSocket); 
} 
} 

回答

0

我解決了這個問題。它與其他SDK有衝突。

相關問題