Android: Could not resolve project :unityLibrary. ... / No matching configuration of project :unityLibrary was found.
Opened this issue · 18 comments
Dear all,
I try to build an existent React_Native project with your library :
- I obtain the build failure described below :
- Would you have already met this problem ?
Thank's a lot.
Failure
**FAILURE: Build failed with an exception.
- What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve project :unityLibrary.
Required by:
project :app > project :azesmway_react-native-unity
> No matching configuration of project :unityLibrary was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' but:
- None of the consumable configurations have attributes**
Version of installed tools:
- Unity Version: 2021.3.5f1
- Your example gradle version: gradle-7.2-all
==> react-native info results:
info Fetching system and libraries information...
(node:10892) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ...
to show where the warning was created)
System:
OS: Windows 10 10.0.19044
CPU: (4) x64 11th Gen Intel(R) Core(TM) i3-1115G4 @ 3.00GHz
Memory: 538.68 MB / 7.65 GB
Binaries:
Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
Watchman: 20210110.135312.0 - C:\ProgramData\chocolatey\bin\watchman.EXE
SDKs:
Android SDK:
API Levels: 20, 26, 27, 28, 29, 30, 31, 32
Build Tools: 26.0.2, 27.0.3, 28.0.3, 29.0.0, 29.0.1, 29.0.2, 29.0.3, 30.0.0, 30.0.1, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.0.0, 33.0.0
System Images: android-30 | Google Play Intel x86 Atom, android-32 | Google APIs Intel x86 Atom_64
Android NDK: 22.1.7171670
Windows SDK: Not Found
IDEs:
Android Studio: AI-213.7172.25.2113.9123335
Visual Studio: 16.11.32602.291 (Visual Studio Community?2019)
Languages:
Java: 19.0.1
Python: 3.10.0
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: ~0.63.4 => 0.63.4
react-native-windows: 0.63.41 => 0.63.41
npmGlobalPackages:
react-native: Not Found.
same error!
@PandaNut did you follow the steps ? because it looks like the module is not able to find the Android Exported files.
go through the steps once again.
I have the same issue. I am using Expo in managed mode, and I got the same error after installing this package even before I import it in my code or updating the Gradle files. After updating the Gradle files the error persists.
Hi @Luluno01 , @uasad1099 , @PandaNut did you solve this issue ?
Hi @Luluno01 , @uasad1099 , @PandaNut did you solve this issue ?
Cause
Yes. Sorry I forgot there is such an issue. In my case, it is caused by:
- The project was auto-linked by Expo, and this behavior was not able to be disabled (I followed the docs to disable but somehow it was still auto-linked)
- There is no Unity project I exported and registered to Gradle build files at that time.
My Solution
So, my solution was to vendor this package, in order to forcibly exclude it from auto-linking, and then manually link it through custom config plugins modifying the Gradle build files (as instructed in the README, with an extra dependency entry that points to the vendored source code of this package, and an extra line of code in MainApplication.java
that registers the native view) when the feature is enabled explicitly in app config.
Alternatively, I assume you can simply install this package and make sure there is a Unity project (a real one or a placeholder that makes Gradle and the native binding happy) and register it to Gradle (as instructed by step 2). One more thing to notice is that when you use EAS Build, make sure the Unity project is included in the project archive, i.e., the Unity project is not in your .gitignore
if .easignore
does not exist, or not in your .easignore
if .easignore
exists. Otherwise, Gradle will complain again when building with EAS Build because the Unity project is excluded from its working copy of your Expo project.
I've added directly in the included project
android/settings.gradle
include ':unityLibrary'
project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary')
android/app/build.gradle (dependencies)
implementation project(':unityLibrary')
implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
And?
after adding implementation the error changed to could not find implementation()
after adding implementation the error changed to could not find implementation()
It sounds like either the path of the implementation is wrong, or the pointed-to unity Android project folder does not exist in your build environment. If you are using EAS, you need to make sure the unity Android project folder is not ignored.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
- What went wrong:
Could not determine the dependencies of task ':azesmway_react-native-unity:compileDebugAidl'.
Could not resolve all task dependencies for configuration ':azesmway_react-native-unity:debugCompileClasspath'.
Could not resolve project :unityLibrary.
Required by:
project :azesmway_react-native-unity
> No matching configuration of project :unityLibrary was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.3.1' but:
- None of the consumable configurations have attributes.
I removed that implementaion line now the error is this.. any idea on how to solve this
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
i am done with this but still i got he same error
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:.
Required by:
project :unityLibrary
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibrary
It seems your Unity project export has failed and the arcore_client.aar
file is not generated under the folder unityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files under unityLibrary/libs
, namely ARPresto.aar
, UnityARCore.aar
, arcore_client.aar
, unity-classes.jar
, and unityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error. Alternatively, you can build the exported project via Gradle build command (gradle build
or something similar, can't remember).
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.
Actully build and run with unity working well on android. but when i export project in react native i got error which one i already shared. build failed because of this error
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.Actully build and run with unity working well on android. but when i export project in react native i got error which one i already shared. build failed because of this error
Okay. So it sounds like some Gradle debugging/hacking to do. As I'm not much a Gradle user, I'm not sure what the root cause is and what the "correct" way is to solve this. What I can suggest is, since it complains about a missing dependency, you can try manually declaring it (by copy-pasting/altering some lines from unityLibrary/build.gradle
) before referencing the project :unityLibrary
. Not sure if this would work, though.
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.Actully build and run with unity working well on android. but when i export project in react native i got error which one i already shared. build failed because of this error
Can you also try moving implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
to rn-project-root/android/build.gradle
, as instructed by README?
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.Actully build and run with unity working well on android. but when i export project in react native i got error which one i already shared. build failed because of this error
Can you also try moving
implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
torn-project-root/android/build.gradle
, as instructed by README?
Yes, I have done with all of this implementation. still i have the two error when try to build rn project in android
1: Could not determine the dependencies of task ':unityLibrary:compileDebugAidl'.
Could not resolve all task dependencies for configuration ':unityLibrary:debugCompileClasspath'.
Could not find :arcore_client:.
Required by:
project :unityLibrary
Could not find :UnityARCore:.
Required by:
project :unityLibrary
Could not find :ARPresto:.
Required by:
project :unityLibrary
Could not find :unityandroidpermissions:.
Required by:
project :unityLibrary
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
2: Could not find :arcore_client:.
Required by:
project :unityLibrary
I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.I've added directly in the included project
android/settings.gradle include ':unityLibrary' project(':unityLibrary').projectDir=new File('..(path to)....\\unityLibrary') android/app/build.gradle (dependencies) implementation project(':unityLibrary') implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
and building works fine now.
When i completed integrations in react native and try to build in android i stuck in an error
Could not find :arcore_client:. Required by: project :unityLibraryIt seems your Unity project export has failed and the
arcore_client.aar
file is not generated under the folderunityLibrary/libs
. You can verify this by checking that folder. In my case, there are 5 files underunityLibrary/libs
, namelyARPresto.aar
,UnityARCore.aar
,arcore_client.aar
,unity-classes.jar
, andunityandroidpermissions.aar
. After exporting, you can "build" from Unity Editor to verify if the exported project itself can build without an error.Actully build and run with unity working well on android. but when i export project in react native i got error which one i already shared. build failed because of this error
Can you also try moving
implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
torn-project-root/android/build.gradle
, as instructed by README?Yes, I have done with all of this implementation. still i have the two error when try to build rn project in android
1: Could not determine the dependencies of task ':unityLibrary:compileDebugAidl'.
Could not resolve all task dependencies for configuration ':unityLibrary:debugCompileClasspath'.
Could not find :arcore_client:.
Required by:
project :unityLibrary
Could not find :UnityARCore:.
Required by:
project :unityLibrary
Could not find :ARPresto:.
Required by:
project :unityLibrary
Could not find :unityandroidpermissions:.
Required by:
project :unityLibraryPossible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
2: Could not find :arcore_client:. Required by: project :unityLibrary
The error message might indicate the first error is caused by the second error. In summary, the issue you are facing is, you have declared the project :unityLibrary
, and Gradle is able to include unityLibrary/build.gradle
, but Gradle is not able to find the artifacts required by the project :unityLibrary
. According to the Gradle troubleshooting document Declaring repositories you attached, this should be solved by following the instructions in README:
Add into android/build.gradle
allprojects { repositories { // this flatDir { dirs "${project(':unityLibrary').projectDir}/libs" } // ...
Given that those artifacts are indeed generated under unityLibrary/libs
, I suspect the directive implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
you added may be problematic. You can verify this by adding some debugging output to build.gradle
(see https://stackoverflow.com/questions/40878923/in-gradle-how-to-print-out-a-message-in-the-console-event-log).
(Sorry I'm not an Gradle expert. All I can help is to provide some generic debugging suggestions.)
Edit:
The directive implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: "*.jar")
is indeed problematic. Note that it includes .jar
files only (include: "*.jar"
). The missing artifacts, however, are .aar
files.