Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project with path 'xrmanifest.androidlib' could not be found in project ':unityLibrary'. #844

Closed
dibenedetto opened this issue Jul 17, 2023 · 12 comments
Labels
android This issue is specific to the Android Platform. ar-foundation bug This issue refers to a bug in the plugin

Comments

@dibenedetto
Copy link

Describe the bug
Build fails with error:
"Project with path 'xrmanifest.androidlib' could not be found in project ':unityLibrary'".

To Reproduce
Steps to reproduce the behavior:
Include a Unity project which uses the XR management 4.4.0.

Expected behavior
Successful build and run.

Screenshots
No screenshot needed.

Unity (please complete the following information):

  • OS: Windows 11
  • Version: 2022.4.3f1

Smartphone (please complete the following information):
It fails on build.

Additional context
No additional info.

@timbotimbo
Copy link
Collaborator

timbotimbo commented Jul 17, 2023

[UPDATE]
See my newer answer in the comments below.

The rest of this comment is outdated.

[Original comment]
You will likely need to edit your gradle files to include this file.
I haven't tested this yet, but it will probably be something like this:

android/settings.gradle

include ":xrmanifest.androidlib"
project(":xrmanifest.androidlib").projectDir = file("./unityLibrary/xrmanifest.androidlib")

android/app/build.gradle

  dependencies {
+        implementation project(':xrmanifest.androidlib')
     }

@dibenedetto
Copy link
Author

You will likely need to edit your gradle files to include this file. I haven't tested this yet, but it will probably be something like this:

android/settings.gradle

include ":xrmanifest.androidlib"
project(":xrmanifest.androidlib").projectDir = file("./unityLibrary/xrmanifest.androidlib")

android/app/build.gradle

  dependencies {
+        implementation project(':xrmanifest.androidlib')
     }

thanks, but it fails with the same error :(

@AdrienGannerie
Copy link

Did you find a solution ? I have the same issue.

@khangpt
Copy link

khangpt commented Jul 18, 2023

me too T_T

@khangpt
Copy link

khangpt commented Jul 18, 2023

I'm not sure this is a solution to make the build is successful. But when I make same with @timbotimbo said, also comment out this line "implementation project('xrmanifest.androidlib')" in unityLibrary/build.gradle ==> flutter run is OK.

But, when run android device, I got below:
Screenshot_20230718_160222

This is log on my console:
Screenshot 2023-07-18 at 16 02 42

This is how I'm using the widget in Flutter:
Screenshot 2023-07-18 at 16 02 48

Hope anybody can help

@timbotimbo
Copy link
Collaborator

timbotimbo commented Jul 18, 2023

Just made a project to test this out.

Apparenty xrmanifest.androidlib is a new folder and not a file like I expected, located in /unityLibrary.

Adding a line to android/settings.gradle made it compile again for me.

  include ":unityLibrary"
  project(":unityLibrary").projectDir = file("./unityLibrary")

+ include ':unityLibrary:xrmanifest.androidlib'

I got this from /unity/<project folder>/Builds/settings.gradle which was generated by Unity. The builds folder is the original build created on an export and parts of that get moved to android/unityLibrary for this plugin.

While testing this ARFoundation ran into issue #836, the error with mUnityplayer in @khangpt's screenshot above.
This means it is likely broken (for now) starting with the Unity versions:

  • 2020.3.46
  • 2021.3.19
  • 2022.2.4
    If you want it to work right now, use a version below these, like 2021.3.18 or 2022.2.3.

@timbotimbo timbotimbo added bug This issue refers to a bug in the plugin android This issue is specific to the Android Platform. ar-foundation labels Jul 18, 2023
@dibenedetto
Copy link
Author

include ':unityLibrary:xrmanifest.androidlib'

this, combined with that, apparently solved the problem: the application is built and it runs on the device, but the AR camera is not open and this error comes out:

E/Unity   (  596): AndroidJavaException: java.lang.NoSuchFieldError: no "Ljava/lang/Object;" field "mUnityPlayer" in class "Lcom/hyperversexr/hyperversexr/MainActivity;" or its superclasses
E/Unity   (  596): java.lang.NoSuchFieldError: no "Ljava/lang/Object;" field "mUnityPlayer" in class "Lcom/hyperversexr/hyperversexr/MainActivity;" or its superclasses
E/Unity   (  596): 	at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
E/Unity   (  596): 	at com.unity3d.player.UnityPlayer.-$$Nest$mnativeRender(Unknown Source:0)
E/Unity   (  596): 	at com.unity3d.player.UnityPlayer$C$a.handleMessage(Unknown Source:122)
E/Unity   (  596): 	at android.os.Handler.dispatchMessage(Handler.java:102)
E/Unity   (  596): 	at android.os.Looper.loop(Looper.java:233)
E/Unity   (  596): 	at com.unity3d.player.UnityPlayer$C.run(Unknown Source:24)
E/Unity   (  596):   at UnityEngine.AndroidJNISafe.CheckException () [0x00091] in \home\bokken\build\output\unity\unity\Modules\AndroidJNI\AndroidJNISafe.cs:24 
E/Unity   (  596):   at UnityEngine.AndroidJNISafe.GetFieldID (System.IntPtr clazz, System.String name, System.String sig) [0x0000e] in \home\bokken\build\output\unity\unity\Modules\AndroidJNI\AndroidJNISafe.

is that related to the original issue?

@timbotimbo
Copy link
Collaborator

That is a different breaking change in Unity, the last section with mUnityplayer I mentioned above.

@dibenedetto
Copy link
Author

That is a different breaking change in Unity, the last section with mUnityplayer I mentioned above.

oh, that's ok, so i'll close this issue, thanks so much.

@dibenedetto
Copy link
Author

That is a different breaking change in Unity, the last section with mUnityplayer I mentioned above.

anyway, on my device, using version 2022.2.21f1 i can see the 3d scene (just a cube) but on a black background, e.g., no camera feedback.

with version 2022.2.0f1 it fails to build.

any idea on that?

@khangpt
Copy link

khangpt commented Aug 8, 2023

That is a different breaking change in Unity, the last section with mUnityplayer I mentioned above.

anyway, on my device, using version 2022.2.21f1 i can see the 3d scene (just a cube) but on a black background, e.g., no camera feedback.

with version 2022.2.0f1 it fails to build.

any idea on that?

I think you should try to enable camera permission on your device first. Hope this help

@JonFaull
Copy link

Any one have any solutions to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android This issue is specific to the Android Platform. ar-foundation bug This issue refers to a bug in the plugin
Projects
None yet
Development

No branches or pull requests

5 participants