我正在尝试用kotlin中的Retrofit做一个简单的REST请求,而且我收到了很多GC错误。我真的不知道如何解决它。我试图在模拟器上添加更多内存,但问题仍然存在。
我的代码是:
val retrofit =Retrofit.Builder().baseUrl("Url")
.addConverterFactory(GsonConverterFactory.create())
.build()
val retrofitAPI = retrofit.create(ApiServices::class.java)
val call = retrofitAPI.getBarcharts(dashboardRequestBean)
call.enqueue(object : Callback<ResponseChartModel<BaseChartModel>> {
override fun onResponse(call: Call<ResponseChartModel<BaseChartModel>>? , response: Response<ResponseChartModel<BaseChartModel>>?) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun onFailure(call: Call<ResponseChartModel<BaseChartModel>>?, t: Throwable?) {
Toast.makeText(this@MainActivity, t?.message, Toast.LENGTH_SHORT).show()
}
})
接口ApiServices
@POST("getDashlet")fun getBarcharts(@Body dashboardRequestBean: DashboardRequestBean): Call<ResponseChartModel<BaseChartModel>>
例外:
FinalizerDaemon: finalize objects = 216
06-15 09:16:14.928 6920-6931/ssa.abc.alrais.kotlindemo I/art:
Background sticky concurrent mark sweep GC freed 65326(1448KB)
AllocSpace objects, 62(1736KB) LOS objects, 36% free, 4MB/7MB, paused
5.406ms total 36.953ms
06-15 09:16:15.118 6920-6931/ssa.abc.alrais.kotlindemo I/art:
Background partial concurrent mark sweep GC freed 69034(1527KB)
AllocSpace objects, 72(2008KB) LOS objects, 39% free, 5MB/8MB, paused
5.698ms total 65.069ms
06-15 09:16:15.340 6920-6931/ssa.abc.alrais.kotlindemo I/art:
Background sticky concurrent mark sweep GC freed 75548(1650KB)
AllocSpace objects, 70(1960KB) LOS objects, 36% free, 5MB/8MB, paused
6.638ms total 49.777ms
06-15 09:16:15.559 6920-6931/ssa.abc.alrais.kotlindemo I/art:
Background partial concurrent mark sweep GC freed 79831(1715KB)
AllocSpace objects, 71(2MB) LOS objects, 40% free, 5MB/9MB, paused
6.345ms total 75.652ms
答案 0 :(得分:1)
android.app.LauncherActivity.ListItem用于显示可以为给定意图执行的所有活动的列表。单击时启动。
所以请检查你的ListItem bean包。