You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using arsceneview compose component initially it works fine but sometimes if I reopen it many times (it is hidden from compose view with if consensus) or when hiding and reopen app the application crushes with stacktrace:
Caused by: java.lang.Throwable: Explicit termination method 'release' not called at dalvik.system.CloseGuard. openWithCallSite( CloseGuard. java: 259) at dalvik.system.CloseGuard. open( CloseGuard. java: 230) at android.view.Surface. setNativeObjectLocked( Surface. java: 682) at android.view.Surface. < init> ( Surface. java: 266) at com.google.ar.infrastructure. imagesubsystem. hardwarebufferstream. AndroidHardwareBufferStreamProvider. nativeContextGetSurface( Native Method) at dai.d(PG:113) at com.google.ar.infrastructure. nativedatasource. imagesubsystem. ImageSubsystemWrapper. setGlTextureOutput( PG: 50) at com.google.ar.core.Session. nativeResume( Native Method) at com.google.ar.core.Session. resume( Session. java: 1) at io.github.sceneview. ar. arcore. ARSession. resume( ArSession. kt: 73) at io.github.sceneview. ar. ARCore. resume( ARCore. kt: 113
val engine = rememberEngine()
val view = rememberView(engine)
val renderer = rememberRenderer(engine)
val scene = rememberScene(engine)
val modelLoader = rememberModelLoader(engine)
val materialLoader = rememberMaterialLoader(engine)
val environmentLoader = rememberEnvironmentLoader(engine)
val collisionSystem = rememberCollisionSystem(view)
// var childNodes = rememberNodes()
// var arSceneView: ARSceneView? by remember { mutableStateOf(null) }
// var frame by remember { mutableStateOf<Frame?>(null) }
var childNodes by remember { mutableStateOf(emptyList()) }
// var childNodes = rememberNodes()
DisposableEffect(Unit) {
onDispose {
// CoroutineScope(Dispatchers.IO).launch {
childNodes.forEach {
// (it as AnchorNode).anchor.detach()
it.destroy()
}
childNodes = emptyList()
}
}
var frame by remember { mutableStateOf<Frame?>(null) }
I initialize all arsceneview objects and dispose properly in above given code.
onViewUpdated = {
if (takePhoto)
takeScreenShot(this, coroutineScope) { bitmap ->
....
fun takePhoto(
view: ARSceneView,
coroutineScope: CoroutineScope,
onPictureSave: suspend (Bitmap) -> Unit
) {
// Create a bitmap the size of the scene view.
val bitmap = Bitmap.createBitmap(
view.width, view.height,
Bitmap.Config.ARGB_8888
)
val handlerThread = HandlerThread("PixelCopier")
handlerThread.start()
PixelCopy.request(view, bitmap, { copyResult: Int ->
if (copyResult == PixelCopy.SUCCESS) {
coroutineScope.launch {
try {
onPictureSave(bitmap)
} catch (e: IOException) {
return@launch
}
}
}
handlerThread.quitSafely()
}, Handler(handlerThread.looper))
}
I only use session object to take a screenshot with the above method given in onViewUpdatedMethod. Did I miss anything? Why it has this behaviour?
Thank you very much
The text was updated successfully, but these errors were encountered:
When using arsceneview compose component initially it works fine but sometimes if I reopen it many times (it is hidden from compose view with if consensus) or when hiding and reopen app the application crushes with stacktrace:
Caused by: java.lang.Throwable: Explicit termination method 'release' not called at dalvik.system.CloseGuard. openWithCallSite( CloseGuard. java: 259) at dalvik.system.CloseGuard. open( CloseGuard. java: 230) at android.view.Surface. setNativeObjectLocked( Surface. java: 682) at android.view.Surface. < init> ( Surface. java: 266) at com.google.ar.infrastructure. imagesubsystem. hardwarebufferstream. AndroidHardwareBufferStreamProvider. nativeContextGetSurface( Native Method) at dai.d(PG:113) at com.google.ar.infrastructure. nativedatasource. imagesubsystem. ImageSubsystemWrapper. setGlTextureOutput( PG: 50) at com.google.ar.core.Session. nativeResume( Native Method) at com.google.ar.core.Session. resume( Session. java: 1) at io.github.sceneview. ar. arcore. ARSession. resume( ArSession. kt: 73) at io.github.sceneview. ar. ARCore. resume( ARCore. kt: 113
val engine = rememberEngine()
val view = rememberView(engine)
val renderer = rememberRenderer(engine)
val scene = rememberScene(engine)
val modelLoader = rememberModelLoader(engine)
val materialLoader = rememberMaterialLoader(engine)
val environmentLoader = rememberEnvironmentLoader(engine)
val collisionSystem = rememberCollisionSystem(view)
// var childNodes = rememberNodes()
// var arSceneView: ARSceneView? by remember { mutableStateOf(null) }
// var frame by remember { mutableStateOf<Frame?>(null) }
var childNodes by remember { mutableStateOf(emptyList()) }
// var childNodes = rememberNodes()
DisposableEffect(Unit) {
onDispose {
// CoroutineScope(Dispatchers.IO).launch {
childNodes.forEach {
// (it as AnchorNode).anchor.detach()
it.destroy()
}
childNodes = emptyList()
}
}
var frame by remember { mutableStateOf<Frame?>(null) }
I initialize all arsceneview objects and dispose properly in above given code.
I only use session object to take a screenshot with the above method given in onViewUpdatedMethod. Did I miss anything? Why it has this behaviour?
Thank you very much
The text was updated successfully, but these errors were encountered: