runtime error
siromidz opened this issue · 3 comments
i get Cannot run program libstunnel.so error=2, No such file or directory
have i missed any thing?
libstunnel.so is the native stunnel executable. The app is not able to find it at runtime
I'm guessing you had this error running on an emulator?
Currently there are only Android ARM binaries provided directly from https://www.stunnel.org/downloads.html. Thus it's currently not possible to use this on an x86 emulator or phone.
In Android Studio you can set up an emulator running on ARMEABI as well. The default is x86 because you'll get better perfomance running an x86 emulator on an x86 host. However, using ARMEABI you should be able to use this library.
I'll add a note about that to the readme now
I examined the code and found out that StunnelBuilder.create()
manually loads the .so
file from ApplicationInfo.nativeLibraryDir
instead of System.loadLibrary()
so you have to set extractNativeLibs to true in AndroidManifest.xml, so libstunnel.so
gets extracted to the nativeLibraryDir at the destination device.
AndroidManifest.xml:
<application
.
.
android:extractNativeLibs="true"
.
. >
System.loadLibrary
would be for native libraries, but the libstunnel.so
file is actually an executable.
Seems that whether extractNativeLibs
is needed or not depends on your app's minSdkVersion (see https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs)
I added extractNativeLibs="true"
to the library's manifest, so now you won't need to add it yourself to your app's manifest.