Reputation: 61
I am trying to build a Unity ARCore application which will be embedded within an existing parent android application. The ARCore project as a standalone is working fine(both as direct apk from Unity and as an apk created from the exported unity android studio project).
When i create a ".aar" library file from the exported unity android studio project and integrate that to the main android application, it does not run, and i get the following error : Missing Unity Engine ARCore support. Please ensure that the Unity project has the 'Player Settings > XR Settings > ARCore Supported' checkbox enabled. .
I have made sure that the "ARcore supported" is enabled in XR settings(also confirmed by the fact the the standalone app is running fine). Also, the unity launch happens correctly from the parent app(i can see my unity UI and start up animations etc.), only ARCore camera does not initialise with the above mentioned error.
Following is the tutorial link i followed to create ".aar" : https://medium.com/@davidbeloosesky/embedded-unity-within-android-app-7061f4f473a
I have also tried the following : https://medium.com/@randive.rishiraj/7-steps-to-integrate-google-arcore-unity-project-to-a-native-android-app-d85793ba0b37
Following is the build.gradle file of the Unity android studio exported project
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(name: 'arcore_client', ext:'aar')
implementation(name: 'arcore_rendering_utils', ext:'aar')
implementation(name: 'arcore_unity', ext:'aar')
implementation(name: 'google_ar_required', ext:'aar')
implementation(name: 'unityandroidpermissions', ext:'aar')
implementation(name: 'unitygar', ext:'aar')
}
android {
compileSdkVersion 28
buildToolsVersion '29.0.2'
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
}
versionCode 1
versionName '1.0'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress '.unity3d', '.ress', '.resource', '.obb'
}
buildTypes {
debug {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
jniDebuggable true
}
release {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
signingConfig signingConfigs.debug
}
}
packagingOptions {
doNotStrip '*/armeabi-v7a/*.so'
doNotStrip '*/arm64-v8a/*.so'
doNotStrip '*/x86/*.so'
}
}
and following is the android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mbrd.ar" xmlns:tools="http://schemas.android.com/tools" android:installLocation="auto">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:isGame="false" android:banner="@drawable/app_banner">
<activity android:label="@string/app_name" android:screenOrientation="portrait" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false" android:name="com.mbrd.ar.UnityPlayerActivity">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN" />-->
<!--<category android:name="android.intent.category.LAUNCHER" />-->
<!--</intent-filter>-->
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<meta-data android:name="unity.tango-enable" android:value="True" />
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />
<meta-data android:name="unity.build-id" android:value="5147ef97-4e9e-47dd-b7ec-317134f40251" />
<meta-data android:name="unity.splash-mode" android:value="0" />
<meta-data android:name="unity.splash-enable" android:value="True" />
<meta-data android:name="android.max_aspect" android:value="2.1" />
</application>
<uses-feature android:glEsVersion="0x00020000" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>
Im using unity 2018.2.16.
Can anyone please give an idea on what might be the cause and what could be done to solve this?
Thank you
Upvotes: 3
Views: 2069
Reputation: 61
To whoever comes across this question :
Was able to solve this. It was a project setting issue. Setting scripting runtime version to .NET 4.x equivalent and Api compatibility level to .NET Standard 2.0 solved it for me.
Upvotes: 2