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

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

Open
ImDolfin opened this issue Aug 8, 2019 · 2 comments

Comments

@ImDolfin
Copy link

ImDolfin commented Aug 8, 2019

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
Copy link
Owner

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
Copy link

bbil commented May 19, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants