Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on Android (FEngine::loop) #8041

Open
deviserandroid opened this issue Aug 13, 2024 · 4 comments
Open

Crash on Android (FEngine::loop) #8041

deviserandroid opened this issue Aug 13, 2024 · 4 comments

Comments

@deviserandroid
Copy link

Bug Description
I am using the AR Core and ARScene to detect the surface and add Renderable Model on the surface. Most of the time, app crashes with logs added below.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Open the Ar Activity to detect the surfaces.
  2. When the surface is detected render a model on the surface.
  3. Things works just fine until user exists the ArActivity.
  4. Exit from the Ar Activity, and reopen the ArActivity to detect the surfaces. App will crash randomly while detecting the surface.

Logs
--------- beginning of crash
14:07:01.885 A Cmdline: com.ardem.android
14:07:01.885 A pid: 27704, tid: 29291, name: binder:27704_7 >>> com.ardemo.android <<<
---------------------------- PROCESS STARTED (10050) for package com.ardemo.dev ----------------------------
14:07:25.943 E Unknown restriction queried by uid 1000 (com.android.settings et al): com.ardemo.android
14:07:27.528 E package com.ardemo.android not found, can't check for attributionTag null
14:07:27.528 E Bad call made by uid 1000. Package "com.ardemo.android" does not belong to uid 10529.
14:07:27.546 E noteOperation
java.lang.SecurityException: Specified package "com.ardemo.android" under uid 10529 but it is not
at com.android.server.appop.AppOpsService.verifyAndGetBypass(AppOpsService.java:4856)
at com.android.server.appop.AppOpsService.noteOperationUnchecked(AppOpsService.java:3496)
at com.android.server.appop.AppOpsService.noteOperationImpl(AppOpsService.java:3484)
at com.android.server.appop.AppOpsService.-$$Nest$mnoteOperationImpl(Unknown Source:0)
at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.lambda$noteOperation$4(AppOpsService.java:7832)
at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher$$ExternalSyntheticLambda4.apply(Unknown Source:33)
at com.android.server.policy.AppOpsPolicy.noteOperation(AppOpsPolicy.java:225)
at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.noteOperation(AppOpsService.java:7830)
at com.android.server.appop.AppOpsService.noteOperation(AppOpsService.java:3468)
at com.android.internal.app.IAppOpsService$Stub.onTransact(IAppOpsService.java:479)
at android.os.Binder.execTransactInternal(Binder.java:1294)
at android.os.Binder.execTransact(Binder.java:1253)
14:09:08.038 E Failed to measure fs-verity, errno 1: /data/app/~~bfJLQpoYd_PCDkdYOL9NVw==/com.ardemo.dev-9hOPHLRmcOps2im5cd6_LQ==/base.apk
14:12:48.130 E setOnBackInvokedCallback(): No window state for package:com.ardemo.dev
14:15:06.128 E setOnBackInvokedCallback(): No window state for package:com.ardemo.dev
14:15:13.522 A Cmdline: com.ardemo.dev
14:15:13.522 A pid: 3559, tid: 4949, name: FEngine::loop >>> com.ardemo.dev <<<
14:15:13.522 A #00 pc 0000000000124708 /data/app/~~bfJLQpoYd_PCDkdYOL9NVw==/com.ardemo.dev-9hOPHLRmcOps2im5cd6_LQ==/base.apk!libfilament-jni.so (BuildId: b0826f2754a95429ecf9e89c83684e184d383cff)

Android Device (please complete the following information):

  • Device: Pixel 3

  • OS: 13

  • Device: Motorola G62 5G

  • OS: 13

Additional context
Code to load surface detection model
`val bitmap = BitmapFactory.decodeResource(resources, R.drawable.surface)
Texture.builder()
.setSource(bitmap)
.build().thenAccept { texture ->
MaterialFactory.makeTransparentWithTexture(this, texture)
.thenAccept { material: Material? ->
bitmap.recycle()

                    focusSquareModel = ShapeFactory.makeCylinder(0.1f, 0f, Vector3.zero(), material)
                    focusSquareModel!!.isShadowCaster = false
                    focusSquareModel!!.isShadowReceiver = false
                }
        }`

Code to load 3D Arrow Model
`ModelRenderable.builder()
.setIsFilamentGltf(true)
.setAsyncLoadEnabled(true)
.setSource(this, R.raw.target_model)
.build()
.thenAccept { modelRenderable ->
modelRenderable?.isShadowCaster = false
modelRenderable?.isShadowReceiver = false
model = modelRenderable

        }
        .exceptionally { _ ->
            null
        }`

Things that I have tried so far:

  1. Detach the Anchors, release the renderable model, close the ARFragment's session when the ARActivity is destroyed.
  2. Comment out the code to observe the Scene's addOnUpdateListener that detects the surface and add Renderable model on the surface. Also comment the code to load the Model.
@mbalajee
Copy link
Contributor

14:15:13.522 A pid: 3559, tid: 4949, name: FEngine::loop >>> com.ardemo.dev <<<
14:15:13.522 A #00 pc 0000000000124708 /data/app/~~bfJLQpoYd_PCDkdYOL9NVw==/com.ardemo.dev-9hOPHLRmcOps2im5cd6_LQ==/base.apk!libfilament-jni.so (BuildId: b0826f2754a95429ecf9e89c83684e184d383cff)

native crash log doesn't say much, try Filament debug or add doNotStrip symbol in gradle file to get unsymbolicated logs

@MinaSamirCap
Copy link

id: 30283, tid: 30514, name: FEngine::loop >>> com.ihearyou.signlanguage <<< #4 pc 000000000016ab40 /data/app/~~bvVcrcgaI1WpCMZNzJd8fA==/com.ihearyou.signlanguage-KPW0b-MKAHU0yHBzZjMygQ==/lib/arm64/libfilament-jni.so (BuildId: 29642a9df93bc3aba66f7265b4cb33ce1e54e6af)

I am facing same error, Also I do not know how to add filament debug or use doNotSrip ..
anyone can help?

@deviserandroid
Copy link
Author

Hello @MinaSamirCap
I couldn't figure out the root cause of the issue.
However, when I moved the ARFragment implementation from the my Activity class to Fragment class, issue was gone for good. To explain in detail, I was using the Activity in which the ArFragment was used. Then I removed that activity and added the same implementation in a Fragment and things got sorted.
Hopefully, this maybe useful.

@MinaSamirCap
Copy link

@deviserandroid thanks for your answer but let me explain more about my situation.

simply I am calling the below code

val buffer = readCompressedAssetToReturnByteBuffer(generateGltfCharacterFilePath(name)) modelViewer.loadModelGltfAsync(buffer) { uri -> readCompressedAssetToReturnByteBuffer("characters/${name.assetName}/$uri") } modelViewer.transformToUnitCube()

it was working properly on all devices I am testing on but when call loadModelGltf
I changed it to LoadModelGltfAsync to enhance the performance of loading gltf files.
This causes the problem only on my device which is Pixel 4 XL but still working properly on other devices.

Hope that gave you more clearance about my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants