Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
753 stars 191 forks source link

[BUG] DllNotFound (webrtc) on Android / IL2CPP / Armv64 #513

Closed streunerlein closed 3 years ago

streunerlein commented 3 years ago

When calling WebRTC.Initialize() there is a DllNotFoundException thrown on device (Android with IL2CPP and only Armv64 selected):

Error Unity DllNotFoundException: Unable to load DLL 'webrtc'. Tried the load the following dynamic libraries: Unable to load dynamic library 'webrtc' because of 'Failed to open the requested dynamic library (0x06000000) dlerror() = dlopen failed: library "webrtc" not found
 at Unity.WebRTC.NativeMethods.RegisterDebugLog (Unity.WebRTC.DelegateDebugLog func) [0x00000] in <00000000000000000000000000000000>
 at Unity.WebRTC.WebRTC.Initialize (Unity.WebRTC.EncoderType type, System.Boolean limitTextureSize, System.Boolean forTest) [0x00000] in <00000000000000000000000000000000>

Steps to reproduce the behavior:

  1. Add the webrtc package version 2.4.0-exp.4 to a new unity project
  2. Build & Run on device
  3. Watch logcat
  4. See error

Environment (please complete the following information):

karasusan commented 3 years ago

We tested it on Unity LTS version 2020.3 and 2019.4, but not 2021.2. Could you check it on 2020.3?

karasusan commented 3 years ago

I could reproduce it. This is an urgent issue. Thanks for your report.

streunerlein commented 3 years ago

Thank you. I suspect it is an isssue with 2021.2, I have made a similar experience with .jar files and even filed a bug for it: https://issuetracker.unity3d.com/issues/android-il2cpp-jar-file-not-included-in-build-when-building-apk-with-il2cpp-and-only-arm64-target-architecture-selected

Probably the two issues are related?

streunerlein commented 3 years ago

Also adding https://issuetracker.unity3d.com/issues/only-some-assemblies-fail-to-be-loaded-when-assembly-name-does-not-match-the-file-name here, as it could be related as well.

karasusan commented 3 years ago

@streunerlein Wow, this is a valuable info. Thank you very much.

karasusan commented 3 years ago

I checked the issue with Unity2021.1.16 but not reproduced. As you said, the cause of the issue seems to be the Unity editor 2021.2.

streunerlein commented 3 years ago

@karasusan Is there something more I can do? Is this being investigated by Unity (via you) or should I file another bug report?

Also, if anyone knows a working workaround that would be amazing. We are crying here because we are so close to get rid of MixedReality-WebRTC but can't because of this.

karasusan commented 3 years ago

@streunerlein I am asking about this issue the mobile team.

streunerlein commented 3 years ago

It seems as if https://issuetracker.unity3d.com/issues/android-il2cpp-jar-file-not-included-in-build-when-building-apk-with-il2cpp-and-only-arm64-target-architecture-selected is fixed for 2022.1 and planned for 2021.2. As this is the version I am on, I would like to keep this issue open until 2021.2 is fixed as well.

streunerlein commented 3 years ago

Update: In 2021.20b13 this is indeed fixed by Unity, we've just run a successful test. Thank you @karasusan