Skip to content

Conversation

kmayoral
Copy link
Contributor

While inspecting an app I work on, I noticed that some of our packaged native shared libraries were not aligned to support 16KB page sizes which are now a possibility with Android 15.

Specifically the filament and gltfio libraries:

/var/folders/tt/grg_b0zj2pbd225l8k92n62c0000gq/T/app-bird-debug_out_XXXXX.odz7PXG5ux/lib/arm64-v8a/libgltfio-jni.so: \e[31mUNALIGNED\e[0m (2**12)
/var/folders/tt/grg_b0zj2pbd225l8k92n62c0000gq/T/app-bird-debug_out_XXXXX.odz7PXG5ux/lib/arm64-v8a/libfilament-jni.so: \e[31mUNALIGNED\e[0m (2**12)

To fix this, we would need to update to a newer version of Filament and a newer version of AGP so that when the project was rebuilt, the libraries would be properly aligned.

While making those changes, I went ahead and updated other dependencies listed below:
Compile/Target SDK 34 -> 35
Kotlin 1.9.24 -> 2.0.21
Gradle 8.7 -> 8.9
AGP 8.4.1 -> 8.7.2
Compose Plugin 2.0.21
ARCore 1.43.0 -> 1.46.0
Filament 1.52.0 -> 1.56.0

Since this involved a material version change, I went ahead and updated the materials that are included in the AAR libraries (but I may not have updated all the materials referenced in various sample projects).

Regenerated various materials:

➜  bin git:(v1.56.0) ./matc -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/camera_stream_depth.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/camera_stream_depth.mat 
➜  bin git:(v1.56.0) ./matc -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/camera_stream_flat.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/camera_stream_flat.mat
➜  bin git:(v1.56.0) ./matc -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/face_mesh.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/face_mesh.mat
➜  bin git:(v1.56.0) ./matc -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/face_mesh_occluder.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/face_mesh_occluder.mat
➜  bin git:(v1.56.0) ./matc -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/plane_renderer.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/plane_renderer.mat
➜  bin git:(v1.56.0) ./matc -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/plane_renderer_shadow.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/plane_renderer_shadow.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/camera_stream_depth.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/camera_stream_depth.mat 
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/camera_stream_flat.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/camera_stream_flat.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/face_mesh.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/face_mesh.mat  
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/face_mesh_occluder.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/face_mesh_occluder.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/plane_renderer.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/plane_renderer.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/assets/materials/plane_renderer_shadow.filamat /Users/keith.mayoral/git_repos/sceneview-android/arsceneview/src/main/materials/plane_renderer_shadow.mat

and

➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/image_texture.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/image_texture.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/opaque_colored.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/opaque_colored.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/opaque_textured.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/opaque_textured.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/transparent_colored.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/transparent_colored.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/transparent_textured.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/transparent_textured.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/video_texture_chroma_key.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/video_texture_chroma_key.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/video_texture.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/video_texture.mat
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/view_renderable.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/view_renderable.mat
Ignoring config entry (unknown key): "defines"
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/view_renderable.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/view_renderable.mat
Ignoring config entry (unknown key): "defines"
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/view_texture_lit.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/view_texture_lit.mat
Ignoring config entry (unknown key): "defines"
➜  bin git:(v1.56.0) ./matc --optimize-size --platform=mobile -o /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/assets/materials/view_texture_unlit.filamat /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/materials/view_texture_unlit.mat

and regenerated environments:

./cmgen --deploy ./output --format=ktx --size=256 --extract-blur=0.1 /Users/keith.mayoral/git_repos/sceneview-android/sceneview/src/main/environments/neutral.hdr 

I used examples of the matc and cmgen commands referenced in this repo to generate the commands I listed above.

Anyways, this may be an incomplete PR if I missed some materials but I wanted to provide it in case it was useful for ongoing migration efforts.

- Crash in SceneView when calling pickNode() which can throw an exception but isn’t caught when destroying the view
- Crash in ArSceneView when view is destroying that could be attempting to double destroy
@kmayoral
Copy link
Contributor Author

I see I also included another commit we have been using in our local build of the libraries to handle some crashes we would see in production via our Crashlytics logs. Those changes addressed our issues so it might be useful in general but feel free to push back there.

Thanks again for an awesome library as always!

@execute008
Copy link

Meanwhile there is already ARCore 1.47.0

@Awsom3D
Copy link

Awsom3D commented Apr 1, 2025

@kmayoral Thanks for your pull request, I hope that someone from Sceneview would consider applying it, but I'm afraid nobody is active anymore.
Could you please provide an .aar of your version of Sceneview ? I'm having a hard time trying to compile the library myself.

@kmayoral
Copy link
Contributor Author

kmayoral commented Apr 1, 2025

Perhaps we should just cc @ThomasGorisse first to see if he can get eyes on this as I see there have been newer PRs that were merged after this one was created but those had him pinged directly. Thank you all!

@kmayoral
Copy link
Contributor Author

kmayoral commented Apr 1, 2025

@Awsom3D , to unblock you in the meantime though, I've included the built debug/release aars I used on my end. Use at your own risk :D
sceneview-aars.zip

@Awsom3D
Copy link

Awsom3D commented Apr 1, 2025

Thank you @kmayoral ! 🙏

@ThomasGorisse ThomasGorisse merged commit 432ae9a into SceneView:main Apr 19, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

4 participants