开发者社区> 问答> 正文

Android sdk 上传图 报java.lang.NoClassDefFoundError: com.squareup.okhttp.OkHttpClient错误

错误原因:java.lang.NoClassDefFoundError: com.squareup.okhttp.OkHttpClient
java.lang.NoClassDefFoundError: com.squareup.okhttp.OkHttpClient
at com.alibaba.sdk.android.oss.internal.InternalRequestOperation.(InternalRequestOperation.java:77)
at com.alibaba.sdk.android.oss.OSSClient.(OSSClient.java:96)
at com.alibaba.sdk.android.oss.OSSClient.(OSSClient.java:73)
at com.zhilai.terminal.app.ui.activity.SignInThreeActivity.upload(SignInThreeActivity.java:236)
at com.zhilai.terminal.app.ui.activity.SignInThreeActivity.onActivityResult(SignInThreeActivity.java:188)
at android.app.Activity.dispatchActivityResult(Activity.java:5192)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3137)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3184)
at android.app.ActivityThread.access$1100(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

报错定位在:
OSS oss = new OSSClient(getApplicationContext(), AppConstants.ENDPOINT, credentialProvider);
这句话上

问题是我已经关联上android SDK中的 okhttp-2.7.0.jar,okio-1.6.0.jar,aliyun-oss-sdk-android-2.0.3.jar三个jar包
程序在编译时没错 运行时报错

展开
收起
发胖白馒头 2016-07-06 00:48:08 5760 0
1 条回答
写回答
取消 提交回答
  • 问题很明显,确定一下okhttp的库添加进工程了没。

    2019-07-17 19:51:49
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
58同城Android客户端Walle框架演进与实践之路 立即下载
Android组件化实现 立即下载
蚂蚁聚宝Android秒级编译——Freeline 立即下载