'Unity as an AR library in an Android Studio project - Could not find :android.arch.lifecycle.runtime-1.0.0:
I am trying to integrate a Unity3D app into my Android app by following the instructions outlined here: https://github.com/Unity-Technologies/uaal-ar-example/blob/master/AndroidProject/README.txt. However, I get the following error:
Could not find :android.arch.lifecycle.runtime-1.0.0:.
Required by:
project :app > project :unityLibrary
Search in build.gradle files
This is what the app level build.gradle for my unityLibrary looks like:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
apply plugin: 'com.android.library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(name: 'android.arch.lifecycle.runtime-1.0.0', ext:'aar')
implementation(name: 'arcore_client', ext:'aar')
implementation(name: 'ARPresto', ext:'aar')
implementation(name: 'com.android.support.support-compat-26.1.0', ext:'aar')
implementation(name: 'com.android.support.support-core-ui-26.1.0', ext:'aar')
implementation(name: 'com.android.support.support-core-utils-26.1.0', ext:'aar')
implementation(name: 'com.android.support.support-fragment-26.1.0', ext:'aar')
implementation(name: 'com.android.support.support-media-compat-26.1.0', ext:'aar')
implementation(name: 'com.android.support.support-v4-26.1.0', ext:'aar')
implementation(name: 'com.google.android.gms.play-services-auth-base-16.0.0', ext:'aar')
implementation(name: 'com.google.android.gms.play-services-base-16.0.1', ext:'aar')
implementation(name: 'com.google.android.gms.play-services-basement-16.0.1', ext:'aar')
implementation(name: 'com.google.android.gms.play-services-tasks-16.0.1', ext:'aar')
implementation(name: 'unityandroidpermissions', ext:'aar')
implementation(name: 'UnityARCore', ext:'aar')
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 30
targetSdkVersion 30
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
versionCode 1
versionName '0.1'
consumerProguardFiles 'proguard-unity.txt', 'proguard-user.txt'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
packagingOptions {
doNotStrip '*/armeabi-v7a/*.so'
doNotStrip '*/arm64-v8a/*.so'
}
}
Here is what the settings.gradle for my Android project looks like:
include ':app'
include ':renderscript-toolkit'
include ':PaintView'
include ':LocationProvider'
include ':GestureListener'
include ':MathForAr'
include ':unityLibrary'
project(':unityLibrary').projectDir=new File('/home/muhammadmehdi/ALL_PROJECTS/memex/memex_unity_app/unityLibrary')
And here is what the build.gradle for my app looks like
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
def setVersionName = { ->
if (project.hasProperty("androidVersionName")) {
println("Replacing versionName with supplied build parameter: " +
"$androidVersionName")
return androidVersionName
} else {
return "1.0"
}
}
android {
compileSdkVersion 31
buildToolsVersion '30.0.3'
defaultConfig {
applicationId "com.memex.eu"
minSdkVersion 30
// this is because of the unity app
targetSdkVersion 30
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
renderscriptTargetApi 18
renderscriptSupportModeEnabled true
versionCode 1
versionName setVersionName()
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
lintOptions {
abortOnError false
}
packagingOptions {
doNotStrip '*/armeabi-v7a/*.so'
doNotStrip '*/arm64-v8a/*.so'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding true
}
androidResources {
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
dependencies {
implementation project(":renderscript-toolkit")
implementation project(path: ':PaintView')
implementation project(path: ':LocationProvider')
implementation project(path: ':GestureListener')
implementation project(path: ':MathForAr')
implementation project(':unityLibrary')
implementation 'com.google.ar:core:1.29.0'
implementation 'com.gorisse.thomas.sceneform:sceneform:1.20.4'
implementation 'com.google.android.gms:play-services-maps:18.0.2'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation "androidx.preference:preference:1.2.0"
implementation 'com.google.android.material:material:1.5.0'
implementation 'com.github.martin-stone:hsv-alpha-color-picker-android:3.0.1'
implementation "androidx.core:core:1.7.0"
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.1"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.1"
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation "androidx.lifecycle:lifecycle-common-java8:2.4.1"
implementation "androidx.room:room-runtime:2.4.1"
annotationProcessor "androidx.room:room-compiler:2.4.1"
// Dagger2 Core
implementation 'com.google.dagger:dagger:2.40.2'
annotationProcessor 'com.google.dagger:dagger-compiler:2.40.2'
// Dagger Android
implementation "com.google.dagger:dagger-android:2.40.2"
implementation "com.google.dagger:dagger-android-support:2.40.2"
annotationProcessor "com.google.dagger:dagger-android-processor:2.40.2"
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:29.0.2')
// Declare the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
implementation 'com.android.support:support-annotations:28.0.0'
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
