'ARCore: Raw Depth Codelab is not working on my phone

I wanted to test this codelab from Google, but whenever I try to run the part3_completed file/application on my Huawei P30 ELE-L29 phone, I encounter the following errors (from logcat):

2022-05-13 12:41:47.466 27231-27231/? E/odelab.rawdept: LoadAppImageStartupCache enabled : 1
2022-05-13 12:41:47.466 27231-27231/? E/odelab.rawdept: Unknown bits set in runtime_flags: 0x8000
2022-05-13 12:41:47.500 27231-27251/com.google.ar.core.codelab.rawdepth E/BehaviorCollectManager: Fail to acquire dataAnalyzerService...
2022-05-13 12:41:47.568 27231-27272/com.google.ar.core.codelab.rawdepth E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@20b4461
2022-05-13 12:41:47.692 27231-27277/com.google.ar.core.codelab.rawdepth E/DepthRenderer: Error compiling shader: 0:56: L0002: Undeclared variable 'f'
    0:57: L0002: Undeclared variable 'f'
    0:58: L0002: Undeclared variable 'kMinHeightMeters'
    0:59: L0002: Undeclared variable 'normalizedHeight'
2022-05-13 12:41:47.694 27231-27277/com.google.ar.core.codelab.rawdepth E/AndroidRuntime: FATAL EXCEPTION: GLThread 1080
    Process: com.google.ar.core.codelab.rawdepth, PID: 27231
    java.lang.RuntimeException: Error creating shader.
        at com.google.ar.core.codelab.common.rendering.ShaderUtil.loadGLShader(ShaderUtil.java:53)
        at com.google.ar.core.codelab.common.rendering.DepthRenderer.createOnGlThread(DepthRenderer.java:67)
        at com.google.ar.core.codelab.rawdepth.RawDepthCodelabActivity.onSurfaceCreated(RawDepthCodelabActivity.java:208)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1560)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1281)

You can clone the sample code through git clone https://github.com/googlecodelabs/arcore-rawdepthapi to check it out yourself.

I'm confused because I didn't change anything in the sample code and I was expecting it to work on my phone since it supports Depth API. I've tried a different depth codelab from Google and it worked but this one somehow doesn't.

Any help would be appreciated :)



Solution 1:[1]

Ok I was able to fix the issue by removing the 'f' at the end of the float assignments for kMinHeightMeters and normalizedHeight. The app works now.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gedyged