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

问题描述 投票:0回答:1

我已使用Google Sceneform Tools(version1.12.0) android ar插件。我已经使用了[[API级别29中的像素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. 在清单文件中,我使用了下面的代码..

    <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>

  • 我使用了类似波纹管的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')

  • 在活动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" />

  • 我在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; });

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

    我已经为Android ar使用了Google Sceneform Tools(version1.12.0)插件。我在API级别29中使用了Pixel 2仿真器。我显示以下错误错误:无法创建AR会话com.google.ar.core ....

    android sceneform
    1个回答
    0
    投票
    我在MainActivity内部使用了波纹管代码后出现的严重错误

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

    © www.soinside.com 2019 - 2024. All rights reserved.