Open RoyalSWiSH opened 5 months ago
Same here!
I think the reason is that unit test are run on x86 and libsodium doesnt have a build for android on x86 (last time I checked, which was some time ago). You should see similar behavior if you try to run the library on x86 android emulator.
Should be fixable by expanding libsoidum to build android x86 target, but I don't have bandwith to look into it right now. A workaround is to skip android unit tests.
-------- Original Message -------- On 6/24/24 10:56 PM, Bernat Carbó wrote:
Same here!
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
I run it on M3 Mac in Android Studio. Guess that is ARM. No issues in the simulator. I thought it was just because it can't access the .so file which is stored in the external library, when I perform local test in my app.
Yes, I guess on arm mac it should work, and you should be able to get it to work by replacing file in this: ''' Platform.isAndroid() -> { File("irrelevant") } ''' with 'SharedLibraryLoader.get().load("libdynamic-macos.dylib", JnaLibsodiumInterface::class.java)'
I don't have access to a mac at the moment, so I can't test if that works correctly.
Interestingly, when using Windows, if I run a test from the common test source as Android(local) that calls LibsodiumInitializer.initialize()
, it lands on Platform.windows
so it tries to load libdynamic-msvc-x86-64-libsodium.dll
and throws the same exception:
java.lang.NullPointerException: Cannot invoke "java.net.URL.getFile()" because "url" is null
at com.goterl.resourceloader.ResourceLoader.getFileFromFileSystem(ResourceLoader.java:244)
at com.goterl.resourceloader.ResourceLoader.copyToTempDirectory(ResourceLoader.java:88)
at com.goterl.resourceloader.SharedLibraryLoader.load(SharedLibraryLoader.java:53)
at com.goterl.resourceloader.SharedLibraryLoader.load(SharedLibraryLoader.java:47)
at com.ionspin.kotlin.crypto.LibsodiumInitializer.loadLibrary(LibsodiumInitializer.kt:30)
at com.ionspin.kotlin.crypto.LibsodiumInitializer.initialize(LibsodiumInitializer.kt:52)
There is similar error on MacOS M1 chip
java.lang.NullPointerException: Cannot invoke "java.net.URL.getFile()" because "url" is null
at com.goterl.resourceloader.ResourceLoader.getFileFromFileSystem(ResourceLoader.java:244)
at com.goterl.resourceloader.ResourceLoader.copyToTempDirectory(ResourceLoader.java:88)
at com.goterl.resourceloader.SharedLibraryLoader.load(SharedLibraryLoader.java:53)
at com.goterl.resourceloader.SharedLibraryLoader.load(SharedLibraryLoader.java:47)
at com.ionspin.kotlin.crypto.LibsodiumInitializer.loadLibrary(LibsodiumInitializer.kt:19)
at com.ionspin.kotlin.crypto.LibsodiumInitializer.initialize(LibsodiumInitializer.kt:52)
HI,
I try to initialize Libsodium from a test environment in a Kotlin Multiplattform project in the shared module from Android Studio.
But it fails with this error
My guess is, that it can't find the libsodium file in the testing environment here
This is the build.gradle.kts file from the shared module