Closed shenzhigang closed 1 year ago
Thanks for reporting!
I haven't really looked much into supporting Android yet. By the looks of the screenshot, I think junixsocket can't find or can't load the native library.
Can you please provide an Android project setup that exposes this bug? This would speed up debugging.
Here is a sample android project that exposes this bug. JunixsocketAndroidSample.zip
In addition, I tried to manually load libjunixsocket-national-2.6.1. so
, and it says that libc
cannot be found. It may be necessary to separately compile native library for Android.
Thanks!
I'm having some beginner's problems with Android Studio (I'm getting "INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113'" with this project, which probably just means that my IDE/device setup is somewhat wrong. (I don't have much experience with Android Studio).
In addition, I tried to manually load libjunixsocket-national-2.6.1. so, and it says that libc cannot be found. It may be necessary to separately compile native library for Android.
Try the -nodeps
library variant, which should not depend on libc. If that doesn't work, then you may have to compile the native library part (junixsocket-native/src/...) against whatever libc equivalent Android provides.
You could also try loading libc from Java (maybe something like System.loadLibrary("c") or System.load with absolute path to libc location)
After further reading the source code, I found that on the Android platform, it is not only necessary to recompile native library. For example, java.rmi
imported by AFUNIXSocketCredentials
is not supported on Android.
It is meaningful to make this excellent library compatible with Android. I will continue to work on this.
@shenzhigang Heads up: I now can compile and run selftest on an Android emulator. It will take a little longer to get it fully working, but we're getting there...
@shenzhigang The Android integration is getting close to being shippable.
Would you mind testing the following APK? Please unzip first junixsocket-selftest-android-2.7.0-SNAPSHOT.apk.zip
See junixsocket-selftest-android
for the source code.
@shenzhigang Could you please verify that it works for you? Thanks for your help!
@shenzhigang Could you please verify that it works for you? Thanks for your help!
Sorry to keep you waiting for so long. Here is the logs: logs.txt
@shenzhigang Great, thanks for providing the selftest logs! Looks like it worked :-)
junixsocket 2.7.0 has been released. Please verify with this version, and re-open if necessary. Thanks again for reporting!
Of note, when building junixsocket-selftest-android, please make sure to use commit 77be9933a0e93c03d5e06b8e968741d828b8391d or newer (where the dependency versions have been updated to 2.7.0)
Describe the bug Error occurs when start the
nanoHttpdServerDemo
.No implementation found for void org.newsclub.net.unix.NativeUnixSocket.initServerImpl
Version: 2.6.1junixsocket-common-2.6.1
,junixsocket-native-common-2.6.1
,junixsocket-server-2.6.1
was imported.To Reproduce Steps to reproduce the behavior:
Output/Screenshots
Environment (please complete the following information):