Reputation: 5053
I have used Google Sceneform Tools(version1.12.0) plugin for android ar. I have used pixel 2 emulator in API level 29. I shows bellow error
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
But I have used bellow code..
In manifest file i have used bellow code..
<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>
I have used gadle file like bellow
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')
In in activity xml I have used bellow code..
<fragment android:name="com.google.ar.sceneform.ux.ArFragment"
android:id="@+id/ux_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
I have used bellow code in 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;
});
What is the wrong with it? I don't know. Can you please help me to solve the problem
Upvotes: 2
Views: 2274
Reputation: 5053
Silly mistake I have used bellow code inside MainActivity
<meta-data android:name="com.google.ar.core" android:value="required" />
My manifest will be..
<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>
Upvotes: 2