android - 应用程序 list 必须包含元数据 com.google.ar.core android sceneform AR

标签 android sceneform

我使用了Google Sceneform Tools(version1.12.0) android ar插件。我使用了 API 级别 29 的 Pixel 2 模拟器。我显示以下错误

Error: Failed to create AR session
com.google.ar.core.exceptions.UnavailableException..........

 Caused by: com.google.ar.core.exceptions.FatalException: Application manifest must contain meta-data com.google.ar.core

但是我使用了以下代码..

  1. 在 list 文件中我使用了以下代码..

      <uses-permission android:name="android.permission.CAMERA" />
     <uses-feature android:glEsVersion="0x00030000" android:required="true" />
     <uses-feature android:name="android.hardware.camera.ar" />
    <application
        ...
      <activity android:name=".MainActivity">
    
        <meta-data android:name="com.google.ar.core" android:value="required" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
    
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    
     </application>
    
  2. 我使用了如下所示的 gadle 文件

    apply plugin: 'com.android.application'
    apply plugin: 'com.google.ar.sceneform.plugin'
     android {
       compileSdkVersion 29
       buildToolsVersion "29.0.2"
       defaultConfig {
       applicationId "com.example.sceneform_ar"
       minSdkVersion 15
       targetSdkVersion 26           
       testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
      }
     }
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
      }
    
     }
    
    dependencies {    
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.12.0'
    
       }
    
    sceneform.asset('sampledata/models/bear.fbx',
         'default',
        'sampledata/models/bear.sfa',
         'src/main/res/raw/bear')
    
  3. 在 Activity xml 中我使用了以下代码..

       <fragment android:name="com.google.ar.sceneform.ux.ArFragment"
        android:id="@+id/ux_fragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    
  4. 我在 MainActivity 中使用了以下代码

        ModelRenderable.builder()
            .setSource(this, R.raw.bear)
            .build()
            .thenAccept(renderable -> bearRenderable = renderable)
            .exceptionally(
                    throwable -> {
                        Log.e("Errror***** >", "Unable to load Renderable.", throwable);
                        return null;
                    });
    

    这有什么问题吗?我不知道。你能帮我解决这个问题吗

最佳答案

愚蠢的错误,我在 MainActivity 中使用了以下代码

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

我的 list 将是..

 <application
......">

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

    <activity android:name=".MainActivity">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

关于android - 应用程序 list 必须包含元数据 com.google.ar.core android sceneform AR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58132998/

相关文章:

android - 错误: this application requires the latest version of Google Play services for AR

android - 无法在 AR 增强脸部中设置 3D 模型的正确方向

augmented-reality - 用于 ARCore 应用程序开发的 OBJ 文件

android - TabActivity 在选项卡更改时销毁每个选项卡的 Activity

java - 尝试在 fragment 选项卡中添加 map 时出错

c# - Android UI 元素统一

android - ActionBarSherlock 和 3.0 之前的 Android 设备

android - Google Sceneform – 是否已弃用?有替代品吗?

java - Android 上的 ARCore 是否支持像 ARKit 一样的实时反射?

android - 从另一个 Activity 中打开一个 Activity 的 fragment