android – Unable to load Renderable when trying to implement ar core-ThrowExceptions

Exception or error:

Why am i getting this error when trying to create an ar app?

Unable to load Renderable registryId='android.resource://com.nevco.ar/raw/cat'
    java.util.concurrent.CompletionException: java.lang.AssertionError: No RCB file at uri: android.resource://com.nevco.ar/raw/cat

I am folliwng this tutorial to create a simple ar app, but everytime i launch my app i keep getting this error. I am not sure what to do to fix this. Some help would be grealty appreciated. I attached the link to the tutorial. https://www.androidauthority.com/google-arcore-972579/

public class MainActivity extends AppCompatActivity {
    private static final String TAG = MainActivity.class.getSimpleName();
    private static final double MIN_OPENGL_VERSION = 3.0;

//Create a member variable for ModelRenderable//

    private ModelRenderable dinoRenderable;

//Create a member variable for ArFragment//

    private ArFragment arCoreFragment;

    @RequiresApi(api = VERSION_CODES.N)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!checkDevice((this))) {
            return;
        }

        setContentView(R.layout.activity_main);
        arCoreFragment = (ArFragment)

//Find the fragment, using fragment manager//

                getSupportFragmentManager().findFragmentById(R.id.main_fragment);

        if (Build.VERSION.SDK_INT >= VERSION_CODES.N) {

//Build the ModelRenderable//

            ModelRenderable.builder()
                    .setSource(this, R.raw.cat)
                    .build()
                    .thenAccept(renderable -> dinoRenderable = renderable)
                    .exceptionally(

//If an error occurs...//

                            throwable -> {

//...then print the following message to Logcat//

                                Log.e(TAG, "Unable to load renderable");
                                return null;
                            });
        }

//Listen for onTap events//

        arCoreFragment.setOnTapArPlaneListener(
                (HitResult hitResult, Plane plane, MotionEvent motionEvent) -> {
                    if (dinoRenderable == null) {
                        return;
                    }

                    Anchor anchor = hitResult.createAnchor();

//Build a node of type AnchorNode//

                    AnchorNode anchorNode = new AnchorNode(anchor);

//Connect the AnchorNode to the Scene//

                    anchorNode.setParent(arCoreFragment.getArSceneView().getScene());

//Build a node of type TransformableNode//

                    TransformableNode transformableNode = new TransformableNode(arCoreFragment.getTransformationSystem());

//Connect the TransformableNode to the AnchorNode//

                    transformableNode.setParent(anchorNode);

//Attach the Renderable//

                    transformableNode.setRenderable(dinoRenderable);

//Set the node//

                    transformableNode.select();
                });
    }

    public static boolean checkDevice(final Activity activity) {

//If the device is running Android Marshmallow or earlier...//

        if (Build.VERSION.SDK_INT < VERSION_CODES.N) {

//...then print the following message to Logcat//

            Log.e(TAG, "Sceneform requires Android N or higher");
            activity.finish();
            return false;
        }
        String openGlVersionString =
                ((ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE))
                        .getDeviceConfigurationInfo()

//Check the version of OpenGL ES//

                        .getGlEsVersion();

//If the device is running anything less than OpenGL ES 3.0...//

        if (Double.parseDouble(openGlVersionString) < MIN_OPENGL_VERSION) {

//...then print the following message to Logcat//

            Log.e(TAG, "Requires OpenGL ES 3.0 or higher");
            activity.finish();
            return false;
        }
        return true;
}

}

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *