Ошибка создания ar сессии aruler

This is my main code

package com.example.ar;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.MotionEvent;
import android.widget.Toast;

import com.google.ar.core.Anchor;
import com.google.ar.core.HitResult;
import com.google.ar.core.Plane;
import com.google.ar.sceneform.AnchorNode;
import com.google.ar.sceneform.rendering.ModelRenderable;
import com.google.ar.sceneform.ux.ArFragment;
import com.google.ar.sceneform.ux.TransformableNode;

public class MainActivity extends AppCompatActivity
{
    private static final String TAG = MainActivity.class.getSimpleName();
    private static final double MIN_OPENGL_VERSION = 3.0;
    ArFragment arFragment;
    ModelRenderable lampPostRenderable;
    @Override
    @SuppressWarnings({"AndroidApiChecker", "FutureReturnValueIgnored"})

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!checkIsSupportedDeviceOrFinish(this))
        {
            return;
        }
        setContentView(R.layout.activity_main);
        arFragment = (ArFragment) getSupportFragmentManager().findFragmentById(R.id.ux_fragment);
        ModelRenderable.builder().setSource(this, Uri.parse("lamppost.sfb")).build()
                .thenAccept(renderable -> lampPostRenderable = renderable)
                .exceptionally(throwable ->
                {
                    Toast toast = Toast.makeText(this, "Unable to load andy renderable",
                            Toast.LENGTH_LONG);
                    toast.setGravity(Gravity.CENTER, 0, 0);
                    toast.show();
                    return null;
                }
                );
        arFragment.setOnTapArPlaneListener((HitResult hitresult, Plane plane, MotionEvent motionevent) -> {
            if (lampPostRenderable == null){
                return;  }
            Anchor anchor = hitresult.createAnchor();
            AnchorNode anchorNode = new AnchorNode(anchor);
            anchorNode.setParent(arFragment.getArSceneView().getScene());
            TransformableNode lamp = new TransformableNode(arFragment.getTransformationSystem());
            lamp.setParent(anchorNode);
            lamp.setRenderable(lampPostRenderable);
            lamp.select();
        });
    }

    public static boolean checkIsSupportedDeviceOrFinish(final Activity activity)
    {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
        {
            Log.e(TAG, "Sceneform requires Android N or later");
            Toast.makeText(activity, "Sceneform requires Android N or later", Toast.LENGTH_LONG).show();
            activity.finish();
            return false;
        }
    String openGlVersionString =
            ((ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE))
                    .getDeviceConfigurationInfo().getGlEsVersion();
    if (Double.parseDouble(openGlVersionString) < MIN_OPENGL_VERSION)
    {
        Log.e(TAG, "Sceneform requires OpenGL ES 3.0 later");
        Toast.makeText(activity, "Sceneform requires OpenGL ES 3.0 or later", Toast.LENGTH_LONG).show();
        activity.finish();
        return false;
    }
        return true;
    }
}

And I’ve also included

 <meta-data
        android:name="com.google.ar.core"
        android:value="required" />

in the Android manifest file.

Gradle module:app has

 implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.15.0'

and gradle project has

 classpath 'com.google.ar.sceneform:plugin:1.5.0'

in dependencies.

My sampledata folder has an obj and a mtl file with the name lamppost.

On opening the app the error is displayed as «Failed to create AR session»
with a black screen and an animation of a hand holding a device rotating in circles here’s how it looks like.

@Zhuxf1111

When i first ran hellosceneform , it can normal use.Later i ran it , the «Failed to create AR session» appeared

@Zhuxf1111

The device is Samsung Galaxy S7 edge

@KamikX

Hi @Zhuxf1111 check if you have this in AndroidManifest.xml inside application tag

        <meta-data
            android:name="com.google.ar.core"
            android:value="required" />
ilyavitek, Kanunnikoff, akhil117, zhangruize, ndubkov, PetreaLoredana, luiscal4a, bryan-ibrahim, hkawii, leenabhandari, and 2 more reacted with thumbs up emoji

@Zhuxf1111

@KamikX Hi , i checked my AndroidManifest.xml and it contain the codes. I used the demo hellosceneform and it worked fine before.

@malik-at-work

Hi @Zhuxf1111 can you add anything in the log?
You can get the log from the log monitor window in android studio or via ‘adb logcat’

The first things I would check in general if the app is not working include: the version I had installed for ArCore, and the permissions on the app just to make sure camera access is allowed.

@Zhuxf1111

Hi @malik-at-work ,I have updated the ArCore version and add the permission on the app .The log is so much and i dont know which of them is you needed.So i attach all of them below

@Zhuxf1111

@malik-at-work

@claywilkinson

@Zhuxf1111 — Can you modify SolarActivity.java by adding the catch FatalException clause in onResume?
At line 243, add

      } catch (FatalException ex) {
        android.util.Log.e("SolarSystem", "FatalException creating session: " + ex.getMessage(), ex);
      }

And then share what is printed in the log?

@Zhuxf1111

@claywilkinson I reset the mobile phone to factory .Then it works fine.

@claywilkinson

@MuhammamdArslanKhan

Same issue I am using an emulator.»Failed to create AE session»
emulator version
27.3.10-4969155

Android version
8.1 (Oreo) — API 27

OpenGL setting

Renderer maximum
SwiftShader

@chnouman

Same issue previously it was working and suddenly it stopped working. Tried uninstalling app and other stuff but no luck.

@nitink133

Same issue here but with back camera.

@3bdar7man

Как установить Сервисы Google Play для AR на Android устройство, которое не поддерживается ими

В последнее время технологии дополненной реальность (Augment Reality или сокращенно — AR) начали использоваться в различных приложениях для мобильных устройств. Это игры, а также приложения Камеры и мессенджеры где вы можете добавить AR стикеры на изображения, приложения для измерения реальных объектов и множество других программ.

Однако очень часто эти возможности доступны только владельцам тех моделей смартфонов, которые входят в число устройств, совместимых с Сервисами Google Play для AR. И хотя это достаточно обширный круг смартфонов и планшетов от различных производителей, он охватывает далеко не все устройства, присутствующие сегодня на рынке.

И как же быть тем, чьё устройство не имеет соответствующей поддержки?

Они могут «обмануть» Сервисы Google Play для AR, заставив их считать, что они работают на совместимом с ними смартфоне. Сделать это можно с помощью модуля для Magisk с наименованием ARCore/Playground Patcher, после установки которого вы получите возможность пользоваться функциями дополненной реальности в различных приложениях, а также стикерами дополненной реальности от Google: Plajmoji.

Как установить Сервисы Google Play для AR на Android устройство, которое не поддерживается ими

1. Для этого вам понадобится смартфон с Magisk и специально созданный для этих целей модуль ARCore/Playground Patcher который вы можете скачать по этой ссылке.

2. Запустите приложение Magisk Manager, откройте меню его настроек, выберите «Меню» -> «Модули» -> кнопка (+) и установите скачанный ранее вами модуль.

Как установить Сервисы Google Play для AR на Android устройство, которое не поддерживается ими

3. После установки модуля ARCore/Playground Patcher перезагрузите свой телефон. Вы заметите, что новый модуль появился в списке модулей приложения Magisk Manager.

Как установить Сервисы Google Play для AR на Android устройство, которое не поддерживается ими

4.  Скачайте из Google Play Маркет Сервисы Google  Play для AR 

Скачайте отсюда установочный APK файл свежей версии модифицированных стикеров Playground и установите его.

5. Если вы хотите воспользоваться другими AR стикерами Google , скачайте их из Google Play Маркет по следующим ссылкам:

Playground: Pets

Playground: Signs

Playground: Food

Playground: Love

Playground: Weather

Playground: Sports

Playground: Travel

Playground: POKÉMON Detective Pikachu

Playground: Winter

AR Stickers: Blocks

AR Stickers: Text

Вы можете воспользоваться этими стикерами в фирменном приложении Google Камера, предназначенном для смартфонов Google Pixel, в его модифицированных версиях для различных моделей смартфонов, которые можно скачать отсюда и в прочих приложениях, поддерживающих Сервисы Google для AR.

Google Play Services for AR


Похожие материалы:

  • Google начинает развертывание функции слияния виртуальных (AR) объектов с реальными изображениями
  • Сторонние приложения для съемки фото на Android устройствах вскоре могут получить возможности Google Камеры
  • Google Measure. Приложение для измерения расстояний и объектов с помощью камеры смартфона обновилось, получив целый ряд улучшений
  • NewPipe. Одно из приложений, способных обеспечить нам просмотр контента из Youtube без рекламы обновилось, получив целый ряд усовершенствований
  • Поддержку Сервисов Google Play для AR (ARCore) получил целый ряд смартфонов и планшетов различных производителей (Обновлено: линейка смартфонов Xiaomi Redmi Note 8)

Теги:

  • root права
  • дополненная реальность
  • инструкция
  • советы и подсказки

Я пытаюсь создать простое приложение AR, используя AR Core и Sceneform Sdk. Я использую эмулятор Android Studio для тестирования своего приложения. Я также следовал примеру кода HelloAr для Sceneform sdk. Но в logcat отображается такая ошибка.

2019-05-04 14:27:15.942 5172-5172/com.example.arcoredemo E/native: status.cc:156 generic::internal: Physical cameras don't match device profile. 0 expected back facing:CameraDirection::kRearFacing actual back facing:CameraDirection::kFrontFacing
2019-05-04 14:27:15.943 5172-5172/com.example.arcoredemo E/native: session_create_implementation_shared.cc:1544 Failed to initilize the data source - -2
2019-05-04 14:27:15.946 5172-5172/com.example.arcoredemo E/native: session_create_implementation_shared.cc:1545 CreateLiveSessionWithMostDependencies returning ArStatusErrorSpace::AR_ERROR_FATAL: .
2019-05-04 14:27:15.963 5172-5172/com.example.arcoredemo I/native: feature_combo_node.cc:176 Cleared scoped_image buffers in feature_combo.
2019-05-04 14:27:15.966 5172-5172/com.example.arcoredemo I/native: android_camera.cc:730 Reset cleanly got to CLOSED state for camera 0
2019-05-04 14:27:15.972 5172-5172/com.example.arcoredemo I/native: session_create_implementation.cc:148 ArSession_createWithSettingsImplementation_private returning ArStatusErrorSpace::AR_ERROR_FATAL: .
2019-05-04 14:27:15.972 5172-5195/com.example.arcoredemo V/third_party/redwood/base/jni_common/jni_helper.cc: ~JniHelper: about to detach thread (Called from line 281).
2019-05-04 14:27:15.973 5172-5195/com.example.arcoredemo V/third_party/redwood/base/jni_common/jni_helper.cc: ~JniHelper: detached thread (Called from line 281).
2019-05-04 14:27:15.981 5172-5172/com.example.arcoredemo E/StandardArFragment: Error: Failed to create AR session
    com.google.ar.core.exceptions.UnavailableException
        at com.google.ar.sceneform.ux.BaseArFragment.initializeSession(BaseArFragment.java:356)
        at com.google.ar.sceneform.ux.BaseArFragment.onResume(BaseArFragment.java:311)
        at android.support.v4.app.Fragment.performResume(Fragment.java:2498)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1501)
        at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
        at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3269)
        at android.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:3241)
        at android.support.v4.app.FragmentController.dispatchResume(FragmentController.java:223)
        at android.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:538)
        at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:527)
        at android.support.v7.app.AppCompatActivity.onPostResume(AppCompatActivity.java:172)
        at android.app.Activity.performResume(Activity.java:7317)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3776)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3816)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: com.google.ar.core.exceptions.FatalException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at com.google.ar.core.Session.throwExceptionFromArStatus(Session.java:134)
        at com.google.ar.core.Session.nativeCreateSessionAndWrapperWithFeatures(Native Method)
        at com.google.ar.core.Session.<init>(Session.java:19)
        at com.google.ar.sceneform.ux.BaseArFragment.createSessionWithFeatures(BaseArFragment.java:381)
        at com.google.ar.sceneform.ux.BaseArFragment.createSession(BaseArFragment.java:370)
        at com.google.ar.sceneform.ux.BaseArFragment.initializeSession(BaseArFragment.java:344)
        at com.google.ar.sceneform.ux.BaseArFragment.onResume(BaseArFragment.java:311) 
        at android.support.v4.app.Fragment.performResume(Fragment.java:2498) 
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1501) 
        at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784) 
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852) 
        at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3269) 
        at android.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:3241) 
        at android.support.v4.app.FragmentController.dispatchResume(FragmentController.java:223) 
        at android.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:538) 
        at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:527) 
        at android.support.v7.app.AppCompatActivity.onPostResume(AppCompatActivity.java:172) 
        at android.app.Activity.performResume(Activity.java:7317) 
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3776) 
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3816) 
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51) 
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 

Hello Ar Activity, где я создаю инициализацию и создание сеанса ar.

    private static final String TAG = HelloArActivity.class.getSimpleName();
    private static final double MIN_OPENGL_VERSION = 3.0;

    private ArFragment arFragment;
    @Override
    @SuppressWarnings({"AndroidApiChecker", "FutureReturnValueIgnored"})
    // CompletableFuture requires api level 24
    // FutureReturnValueIgnored is not valid
    protected void onCreate(Bundle savedInstanceState) {


        if (!checkIsSupportedDeviceOrFinish(this)) {
            return;
        }
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hello_ar);
        arFragment = (ArFragment) getSupportFragmentManager().findFragmentById(R.id.ux_fragment);

        // When you build a Renderable, Sceneform loads its resources in the background while returning
        // a CompletableFuture. Call thenAccept(), handle(), or check isDone() before calling get().
       arFragment.setOnTapArPlaneListener((hitResult, plane, motionEvent) -> {
           Anchor anchor = hitResult.createAnchor();
           MaterialFactory.makeOpaqueWithColor(this,new Color(android.graphics.Color.RED))
                   .thenAccept(material -> {
                       ModelRenderable renderable  = ShapeFactory.makeSphere(1.0f,new Vector3(0f,1f,1f),material);
                       AnchorNode anchorNode = new AnchorNode(anchor);
                       anchorNode.setRenderable(renderable);
                       arFragment.getArSceneView().getScene().addChild(anchorNode);
                   });
       });
    }

    /**
     * Returns false and displays an error message if Sceneform can not run, true if Sceneform can run
     * on this device.
     *
     * <p>Sceneform requires Android N on the device as well as OpenGL 3.0 capabilities.
     *
     * <p>Finishes the activity if Sceneform can not run
     */
    public static boolean checkIsSupportedDeviceOrFinish(final Activity activity) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
            Log.e(TAG, "Sceneform requires Android N or later");
            Toast.makeText(activity, "Sceneform requires Android N or later", Toast.LENGTH_LONG).show();
            activity.finish();
            return false;
        }
        String openGlVersionString =
                ((ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE))
                        .getDeviceConfigurationInfo()
                        .getGlEsVersion();
        if (Double.parseDouble(openGlVersionString) < MIN_OPENGL_VERSION) {
            Log.e(TAG, "Sceneform requires OpenGL ES 3.0 later");
            Toast.makeText(activity, "Sceneform requires OpenGL ES 3.0 or later", Toast.LENGTH_LONG)
                    .show();
            activity.finish();
            return false;
        }
        return true;
    }
}

1 ответ

Epic Developer Community Forums

Loading

Понравилась статья? Поделить с друзьями:
  • Ошибка создания apple id неверная дата
  • Ошибка соединения эпик геймс что делать
  • Ошибка соединения эпик геймс 2022
  • Ошибка соединения фискального регистратора
  • Ошибка соединения телефон