seniorjoinu / reliable-udp

Multiplexed, coroutine-powered reliable UDP for Kotlin using fountain codes
MIT License
30 stars 0 forks source link

java.io.IOException: Native library (android-arm/libwirehair.so) not found in resource path #3

Open ImDolfin opened 5 years ago

ImDolfin commented 5 years ago

Hi, I tried to include your RUDP library but I can not manage to make it run. It builds without any problems, however as soon as I want to open a socket I get the following error: java.lang.ExceptionInInitializerError at net.joinu.wirehair.WirehairLib.(WirehairLib.kt) at net.joinu.wirehair.Wirehair.init(Wirehair.kt:20) at net.joinu.wirehair.Wirehair.init$default(Wirehair.kt:19) at net.joinu.rudp.RUDPSocket.(RUDPSocket.kt:34) at com.hms.wifi.WiFiConnectionManager.(WiFiConnectionManager.kt:71) at com.hms.wifi.WiFiController.run(WiFiController.kt:78) Caused by: java.io.IOException: Native library (android-arm/libwirehair.so) not found in resource path (.) at com.sun.jna.Native.extractFromResourcePath(Native.java:1095) at com.sun.jna.Native.extractFromResourcePath(Native.java:1053) at net.joinu.wirehair.WirehairLib$Companion.(WirehairLib.kt:16) at net.joinu.wirehair.WirehairLib.(WirehairLib.kt)  at net.joinu.wirehair.Wirehair.init(Wirehair.kt:20)  at net.joinu.wirehair.Wirehair.init$default(Wirehair.kt:19)  at net.joinu.rudp.RUDPSocket.(RUDPSocket.kt:34) 

Prior to that error, I received: java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/android-arm/libjnidispatch.so) not found in resource path (.) I managed to fix that according to the solution of https://stackoverflow.com/questions/47800043/android-arm-libjnidispatch-so-not-found-error However, I have no Idea on how to fix that problem with the libwirehair.so I'd realy like to use your implementation because of its simplicity and elegancy, but first I have to make it run :(

Edit: I am using Android Studio with Kotlin 1.3.41 and gradle 3.4.2

seniorjoinu commented 4 years ago

Hey @ImDolfin ! Sorry for such a long delay.

To run this library with Android you first need to compile libwirehair to your ABI. Roughly speaking you need:

  1. download android toolchain
  2. build libwirehair from source using this toolchain (google some examples of how this can be done)
  3. place resulting libwirehair.so under jniLibs/<your-abi>

After this everything should work properly.

bbil commented 4 years ago

@seniorjoinu Where are the sources to build libwirehair.so? I easily found https://github.com/catid/wirehair, but it's unclear to me if that builds this target. I'm a little unfamiliar with reading cmake files.