I/Choreographer: Skipped 196 frames! The application may be doing too much work on its main thread.

2789
1
07-11-2022 12:05 AM
Hakouguelfen
New Contributor

I'm creating an android app using kotlin and arcgis_runtime_android_sdk, and i've faced a problem that i couldn't find solution to.

I want to create a sceneView to show 3d objects inside my app, I've followed the official tutorials on the esri website but this error always occur while running the app:

I/Choreographer: Skipped 196 frames! The application may be doing too much work on its main thread.

the app just freeze and became unusable, I tried to use kotlin coroutine as it's the recommended way by android:

I used semthing like this:

runBlocking{
launch {
setApiKeyForApp()
setupScene()
}
}
// AND I USED
CoroutineScope(Dispatchers.Default).launch {
 setApiKeyForApp()
setupScene()
}

 my setupScene function is: 

fun setupScene() {
val portal:Portal = Portal("https://www.arcgis.com", false)
val itemId:String = "<webScene id>"
val portalItem:PortalItem = PortalItem(portal, itemId)
sceneView.scene = ArcGISScene(portalItem)
}

 

I don't what to do, please help.

0 Kudos
1 Reply
GuntherHeppner
Esri Contributor

Hi @Hakouguelfen ,

Skipped frames may be caused for a variety of reasons and you should try to narrow it down to the potential cause. First of all there is no need to invoke your `setupScene()` function on a coroutine. You can do all of this setup work on the main thread, any processing and IO work is done by ArcGIS Runtime on background threads.

A few more things to consider:
- Test your app on different devices with different CPU, GPU and memory specs. Do you see any differences?
- Compare this specific scene with rendering other scenes, possibly with less data. Are you still seeing these log messages?
- Are you doing any heavy processing or blocking IO work on the main thread?
- Are you listening to any events that fire frequently, for example from the SceneView, such as DrawStatusChangedListener or NavigationChangedListener? If so, what kind of work are you doing in your event listeners and on which thread?
- Use Android Studio's profiler to observe CPU, GPU and memory usage as well as object allocations.

0 Kudos