开发者社区> 问答> 正文

使用okhttp请求阿里云服务器报错IPermissionService.getNetworkType()

我在Android端使用okhttp3请求 想服务器请求数据报以下错误 麻烦帮忙分析下是什么原因造成的
java.lang.NullPointerException: Attempt to invoke interface method 'int com.aliyun.permission.IPermissionService.getNetworkType()' on a null object reference

                                                                      at android.content.Context.getNetworkType(Context.java:3733)
                                                                      at android.content.Context.isAskNetworkDenied(Context.java:3664)
                                                                      at android.content.Context$1.isNetworkDenied(Context.java:3712)
                                                                      at java.net.Socket.connect(Socket.java:917)
                                                                      at okhttp3.internal.platform.AndroidPlatform.connectSocket(AndroidPlatform.java:63)
                                                                      at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:187)
                                                                      at okhttp3.internal.connection.RealConnection.buildConnection(RealConnection.java:173)
                                                                      at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:114)
                                                                      at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:196)
                                                                      at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:132)
                                                                      at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:101)
                                                                      at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
                                                                      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                      at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
                                                                      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                      at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
                                                                      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                      at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
                                                                      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
                                                                      at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
                                                                      at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
                                                                      at okhttp3.RealCall$AsyncCall.execute(RealCall.java:129)
                                                                      at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
                                                                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                      at java.lang.Thread.run(Thread.java:818)

展开
收起
1756050924415768 2017-03-07 14:01:43 5271 0
1 条回答
写回答
取消 提交回答
  • 阿里巴巴高级研发工程师
    麻烦贴一下异常
    2019-07-17 20:52:42
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
如何运维千台以上游戏云服务器 立即下载
网站/服务器取证 实践与挑战 立即下载
ECS计算与存储分离架构实践 立即下载