google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

Sceneform on android 6.x ? #680

Open jpsarda opened 5 years ago

jpsarda commented 5 years ago

As far as I can understand Sceneform (without ARCore) is availabl on 7.x+ devices , is it true ?

Is there a way to get Sceneform on 6.x devices ? Maybe embedding the sdk in the app ?

tpsiaki commented 5 years ago

The Sceneform samples currently demonstrate usage with ARCore, and that's why they are restricted to api 24+ (i.e. 7.x+). This restriction should not be applicable for non-ARCore scenarios and I expect that api 18+ devices (i.e. devices that support GLES 3.0) should be able to run Sceneform. Sceneform libraries themselves only explicitly require a minSDKVersion of 14 (although this low sdk version is primarily used so that the sdk can be included but not used where it is desired as an optional component in an app that is only used on higher versions that support it).

That said, with lower end devices, you may run into more performance issues, and our testing of the platform currently only extends to ARCore devices, so we can't guarantee that it will work across a wide range of lower end devices at this point. Nevertheless, we would like to support it running everywhere possible, so if you run into any bugs with Sceneform failing on anything API 18+, please do report them here.

jpsarda commented 5 years ago

I tested on an 6.0.1 device but I get a log "Sceneform requires Android N or later" and the activity is terminated. Is there a way to force this ?

[edit] My bad it was a check inside the sample app.

jpsarda commented 5 years ago

After disabling the Android version check in my app, I still get the log "SceneView: Sceneform requires Android N or later" And SceneView.getScene() returns null. So there is probably a check to deactivate inside th Sceneform SDK too.

jpsarda commented 5 years ago

To bypass this test I added AndroidPreconditions.setUnderTesting(true); in my code, now I can launch on 6.0.1 but I get an exception when the SceneView is instantiated :

Caused by: java.lang.IllegalArgumentException: major == null
        at android.opengl.EGL14.eglInitialize(Native Method)
        at com.google.ar.sceneform.rendering.GLHelper.makeContext(GLHelper.java:30)
        at com.google.ar.sceneform.rendering.GLHelper.makeContext(GLHelper.java:22)
        at com.google.ar.sceneform.rendering.EngineInstance.createEngine(EngineInstance.java:51)

The error points at the last line of this code in GLHelper.java :

    public static EGLContext makeContext(EGLContext shareContext) {
        EGLDisplay display = EGL14.eglGetDisplay(0);
        int[] minorMajor = null;
        EGL14.eglInitialize(display, (int[])minorMajor, 0, (int[])minorMajor, 0);