运行时执行java.lang.NoClassDefFoundError:Android中的retrofit2.Platform

运行时执行java.lang.NoClassDefFoundError:Android中的retrofit2.Platform,第1张

概述我正在使用Rtofit在实施改造后处理来自Mobile的Serverside数据我得到以下例外任何关于这个问题的知道告诉我我做错了Init Retrofit:mRetrofit = new Retrofit.Builder() .baseUrl(AppConstance.APP_URL)

我正在使用Rtofit在实施改造后处理来自Mobile的ServersIDe数据我得到以下例外任何关于这个问题的知道告诉我我做错了

Init Retrofit:

mRetrofit = new Retrofit.Builder()                    .baseUrl(AppConstance.APP_URL)                    .addConverterFactory(GsonConverterFactory.create())                    .build();            Iservice = mRetrofit.create(IDeaService.class);

Gradle文件

dependencIEs {    compile filetree(dir: 'libs',include: ['*.jar'])    testCompile 'junit:junit:4.12'    compile 'com.androID.support:appcompat-v7:23.2.1'    compile 'com.squareup.retrofit2:retrofit:2.0.2'    compile 'com.squareup.retrofit2:converter-gson:2.0.0'    compile 'com.squareup.okhttp:okhttp:2.2.0'    compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'    compile 'com.squareup.okio:okio:1.7.0'}

堆栈跟踪

   04-26 11:54:36.441 18355-18355/com.omt.example W/dalvikvm: threadID=1: thread exiting with uncaught exception (group=0x41da0c98)04-26 11:54:36.441 18355-18355/com.omt.example W/dalvikvm: threadID=1: uncaught exception occurred04-26 11:54:36.442 18355-18355/com.omt.example W/System.err: java.lang.NoClassDefFoundError: retrofit2.Platform04-26 11:54:36.444 18355-18355/com.omt.example W/System.err:     at retrofit2.Retrofit$Builder.
最佳答案尝试将okhttp更改为okhttp3

compile 'com.squareup.okhttp3:okhttp:3.2.0'compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'

作为retrofit2内部使用okhttp3.

尝试构建和同步gradle.

总结

以上是内存溢出为你收集整理的运行执行java.lang.NoClassDefFoundError:Android中的retrofit2.Platform全部内容,希望文章能够帮你解决运行时执行java.lang.NoClassDefFoundError:Android中的retrofit2.Platform所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1139697.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-31
下一篇2022-05-31

发表评论

登录后才能评论

评论列表(0条)