我已使用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
但是我使用了下面的代码。
- 在清单文件中,我使用了下面的代码..
<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>
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')
<fragment android:name="com.google.ar.sceneform.ux.ArFragment"
android:id="@+id/ux_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
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 ....
<meta-data android:name="com.google.ar.core" android:value="required" />