[ARFoundation] Adding tracked images works properly on iOS but not Android

As [described in this other thread,]( Dynamic XRReferenceImageLibrary in AR Foundation page-2#post-5227103) I’m adding images to the tracking library and that’s working fine on iOS. On Android it’s exhibiting odd behavior where the added images aren’t recognized initially, but do start working if I leave the scene and then reload it. There’s a script that adds ARTrackedImageManager on Start, including adding the images to a MutableRuntimeReferenceImageLibrary.

Does anyone know why this is happening, and how to get AR image tracking working on Android the first time?

Currently my best guess is that the imgdb takes longer to be ready, so I’m thinking I should monitor that using GetPathForLibrary as described here:
https://softwareproduction.eu/2019/…rreferenceimagelibrary-for-arcore-at-runtime/


Note that I’m currently using preview 3 of 3.0, since that was the latest when I started working on this. I see that 3.1 is now available so I’m thinking of upgrading that to see if it helps, although I doubt it will.

hm I just noticed something that may be related in the logcat. I see this OpenGL error the first time I load the scene, but not the second:

OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range
(Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 348)

After some back and forth with @x70x in the other thread I seem to have solved this:
Dynamic XRReferenceImageLibrary in AR Foundation page-2#post-5241887