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

Native library (com/sun/jna/android-aarch64/libjnidispatch.so) not found in resource path (.) #60

Open
aagam-chai opened this issue May 18, 2023 · 5 comments
Assignees

Comments

@aagam-chai
Copy link

Native library (com/sun/jna/android-aarch64/libjnidispatch.so) not found in resource path (.)

For the Context

As I was creating an Android library, encryption was necessary, therefore I added lazysodium to it.

When I tested my library module during development, it was successful.
However, after it was published on github and hosted on jitpack, I called the same function from the SDK, which contains the encryption code, and it consistently produced this problem.

The suspected issue is with the '@aar' thing, is there anything special required to have this dependency in a library module?

photo_2023-05-18 16 41 49

@gurpreet- gurpreet- self-assigned this May 24, 2023
@gurpreet-
Copy link
Contributor

Hi @aagam-chai,

I think all you need to do to the consuming project is add JNA to it...

implementation "net.java.dev.jna:jna:5.13.0@aar"

@KamilKalfas
Copy link

Hi @gurpreet-

I have same issue.

My SDK uses

api "com.goterl:lazysodium-android:5.1.0@aar"
implementation "net.java.dev.jna:jna:5.13.0@aar"

Then in consumer app when :
1)

 implementation project(path: ":my-sdk")

it WORKS

implementation 'com.example.org:my-sdk:version'

Runtime exception

FATAL EXCEPTION: main
Process: com.example.myapplication, PID: 10753
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/android-aarch64/libjnidispatch.so) not found in resource path (.)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1059)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015)
at com.sun.jna.Native.<clinit>(Native.java:221)
at com.sun.jna.Native.register(Native.java:1773)
at com.goterl.lazysodium.SodiumAndroid.<init>(SodiumAndroid.java:36)
at com.goterl.lazysodium.SodiumAndroid.<init>(SodiumAndroid.java:17)
implementation 'com.example.org:my-sdk:version'
implementation "net.java.dev.jna:jna:5.13.0@aar"

Compile exception

Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable

Any suggestions?

@fluxxion82
Copy link

I see this as well in my project. I've added the jna library as a dependency but it still doesn't work for some reason.

@langme
Copy link

langme commented Oct 14, 2024

Already open
I have the same issue with

api "com.goterl:lazysodium-android:5.1.0@aar"
implementation "net.java.dev.jna:jna:5.13.0@aar"

jna = "5.13.0"
kotlin = "2.0.20"

@richshepard
Copy link

richshepard commented Jan 28, 2025

Not sure if this is a workaround, but I wound back my version of JNA to the verion that was around when V5.1.0 of Lazy Sodium was built, which seems to be 5.12.1, so changing the line to:

implementation "net.java.dev.jna:jna:5.12.1@aar"

Seems to get my code to work OK for now at least.

I could be missing something of course.

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

6 participants