devopvoid / webrtc-java

WebRTC for desktop platforms running Java
Apache License 2.0
248 stars 60 forks source link

How to install the native libraries? #52

Closed customautosys closed 1 year ago

customautosys commented 2 years ago

Hi, I added this line to my gradle dependencies: api 'dev.onvoid.webrtc:webrtc-java:0.5.0' and I got

java.lang.RuntimeException: Load library 'webrtc-java' failed
    at dev.onvoid.webrtc.PeerConnectionFactory.<clinit>(PeerConnectionFactory.java:45)

I then tried to add:

api 'dev.onvoid.webrtc:webrtc-java-windows-x86_64:0.1.0'
api 'dev.onvoid.webrtc:webrtc-java-macos-x86_64:0.1.0'
api 'dev.onvoid.webrtc:webrtc-java-linux-x86_64:0.1.0'

Then I got:

Caused by: java.lang.NoSuchMethodError: <init>
    at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
    at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
    at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
    at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
    at java.base/java.lang.Runtime.load0(Runtime.java:768)
    at java.base/java.lang.System.load(System.java:1837)
    at dev.onvoid.webrtc.internal.NativeLoader.loadLibrary(NativeLoader.java:71)

How do I add the native dependencies in gradle?

devopvoid commented 2 years ago

Please search closed issues related to gradle.

customautosys commented 2 years ago

Hi I am so sorry for not searching the closed issues. I followed the instructions in #23 to add the classifiers. However, now it hangs whenever it loads the native library. I have tried to debug it and it does successfully extract the .so file to a temporary file but after that it hangs when calling the native method load0 to actually load the library. Any idea what is wrong?

customautosys commented 2 years ago

Ok so I just tried it faces this problem on Linux but it can run on Windows. However, on Windows it crashed with an error Invalid COM thread model change (MTA->STA)

devopvoid commented 1 year ago

This has been fixed in the latest version.