sceneform-android icon indicating copy to clipboard operation
sceneform-android copied to clipboard

(Java) App crashes on device

Open dhatriparakal opened this issue 1 year ago • 6 comments

My app keeps crashing (testing on a Samsung Galaxy Tab S9+). I followed the tutorial here, it's also in the readme.md file: https://medium.com/make-an-android-ar-augmented-reality-app-for/make-an-ar-augmented-reality-app-for-android-in-2022-48a1711562bb

I'm using java instead of kotlin though, I'm not sure if that would cause any problems? This is my MainActivity.java for reference:

public class MainActivity extends AppCompatActivity {

    ArFragment arFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        // Load model.glb from assets folder or http url
        arFragment = (ArFragment) getSupportFragmentManager().findFragmentById(R.id.arFragment);
        if (arFragment != null) {
            arFragment.setOnTapPlaneGlbModel("model.glb");
        }
        //arFragment.setOnTapPlaneGlbModel("https://github.com/codemaker2015/3d-models/blob/master/glb_files/model.glb?raw=true");

    }
 

These are my error logs:

Process: com.example.minimalarwcamera, PID: 6599
java.lang.NoSuchMethodError: No virtual method acquireEnvironmentalHdrCubeMap()[Lcom/google/ar/core/ArImage; in class Lcom/google/ar/core/LightEstimate; or its super classes (declaration of 'com.google.ar.core.LightEstimate' appears in /data/app/~~42uQ2fjSsRLO0eDYv_fBdg==/com.example.minimalarwcamera-Jt3Ovib2PRvM3NHJKkRdiQ==/base.apk)
                at com.gorisse.thomas.sceneform.light.LightEstimationKt.environmentalHdrEnvironmentLights(LightEstimation.kt:394)
                at com.gorisse.thomas.sceneform.light.LightEstimationKt.environmentLightsEstimate(LightEstimation.kt:225)
                at com.google.ar.sceneform.ArSceneView.onBeginFrame(ArSceneView.java:527)
                at com.google.ar.sceneform.SceneView.doFrameNoRepost(SceneView.java:466)
                at com.google.ar.sceneform.SceneView.doFrame(SceneView.java:450)
                at com.google.ar.sceneform.ArSceneView.doFrame(ArSceneView.java:552)
                at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1687)
                at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1698)
                at android.view.Choreographer.doCallbacks(Choreographer.java:1153)
                at android.view.Choreographer.doFrame(Choreographer.java:1069)
                at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1646)
                at android.os.Handler.handleCallback(Handler.java:958)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loopOnce(Looper.java:230)
                at android.os.Looper.loop(Looper.java:319)
                at android.app.ActivityThread.main(ActivityThread.java:8934)
                at java.lang.reflect.Method.invoke(Native Method)
                at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

dhatriparakal avatar Jun 20 '24 14:06 dhatriparakal

I saw similar errors for others, and some said it was Android 14 related - I just ran my app on an Android 13 emulator and got the same error.

dhatriparakal avatar Jun 20 '24 15:06 dhatriparakal

Is AR Core able to run on emulators now? If so, I'd love to hear how.

Mehequanna avatar Jun 25 '24 22:06 Mehequanna

As for the error, we chatted about this in the Discord group. This is caused by using a mismatched version of ARCore and Sceneform. When using a specific Sceneform Maintained version, it's best to use the same ARCore version the release does. So in this case, com.gorisse.thomas.sceneform:sceneform:1.23.0 is using ARCore version 1.31.0 https://github.com/SceneView/sceneform-android/blob/62a371f1495d1800a279ff43645945c758f3bbbf/build.gradle#L19

Mehequanna avatar Jun 25 '24 22:06 Mehequanna

This issue is the same as #463

Mehequanna avatar Jun 25 '24 23:06 Mehequanna

Is AR Core able to run on emulators now? If so, I'd love to hear how.

I think this error is occuring before ARCore even gets a chance to attempt running on the device, since it crashes immediately after starting. I'm not entirely sure though. Also I think there is a way to use emulators for ARCore but I haven't made any serious attempts at it.

dhatriparakal avatar Jun 26 '24 13:06 dhatriparakal

As for the error, we chatted about this in the Discord group. This is caused by using a mismatched version of ARCore and Sceneform. When using a specific Sceneform Maintained version, it's best to use the same ARCore version the release does. So in this case, com.gorisse.thomas.sceneform:sceneform:1.23.0 is using ARCore version 1.31.0

https://github.com/SceneView/sceneform-android/blob/62a371f1495d1800a279ff43645945c758f3bbbf/build.gradle#L19

Ahh I see, that makes sense - I'll try that and see if it works

dhatriparakal avatar Jun 26 '24 13:06 dhatriparakal

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 25 '24 05:09 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

github-actions[bot] avatar Oct 03 '24 05:10 github-actions[bot]