Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kotlin Squareup改造/Moshi示例流程未关闭_Kotlin_Retrofit2_Moshi - Fatal编程技术网

Kotlin Squareup改造/Moshi示例流程未关闭

Kotlin Squareup改造/Moshi示例流程未关闭,kotlin,retrofit2,moshi,Kotlin,Retrofit2,Moshi,我有一个用于Squareup的改型2 http客户端()的“hello world”应用程序,它使用JSON与Moshi()解组 一切正常,但没有系统。退出(0)应用程序将永远运行 知道为什么吗 import com.squareup.moshi.JsonClass 导入com.squareup.moshi.moshi 导入com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory 2.致电 进口改装2.改装 进口改装2.converte

我有一个用于Squareup的改型2 http客户端()的“hello world”应用程序,它使用JSON与Moshi()解组

一切正常,但没有
系统。退出(0)
应用程序将永远运行

知道为什么吗

import com.squareup.moshi.JsonClass
导入com.squareup.moshi.moshi
导入com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
2.致电
进口改装2.改装
进口改装2.converter.moshi.MoshiConverterFactory
导入文件2.http.GET
导入文件2.http.Path
主要内容(){
MainApp().doIt()
println(“主就绪!”)
系统退出(0)
}
接口服务{
@获取(“用户/{user}/repos”)
趣味listRepos(@Path(“user”)user:String):调用
}
@JsonClass(GenerateDapter=true)
数据类Repo(val full_name:String,val private:Boolean)
类MainApp{
乐事{
val moshi=moshi.Builder()
.addLast(KotlinJsonAdapterFactory())
.build()
val reformationgithub=reformation.Builder()
.baseUrl(“https://api.github.com/")
.addConverterFactory(MoshiConverterFactory.create(moshi))
.build()
val githubService=generationgithub.create(githubService::class.java)
val reposCall:Call=githubService.listRepos(“HoffiMuc”)
val response=reposCall.execute()
if(response.issucessful){
val repos=response.body()?:ArrayList()
如果(repos.isNotEmpty()){
用于(回购中的回购){
println(回购)
}
}否则{
println(“响应正文为空或结果列表中无回购”)
}
}否则{
println(response.headers())
}
}
}

如果在最新版本的OkHttp上添加显式依赖项,会发生什么情况?旧版本的改型依赖于使用的非守护进程线程