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

Support for running Mordant in Android #165

Open
hick209 opened this issue Mar 25, 2024 · 2 comments
Open

Support for running Mordant in Android #165

hick209 opened this issue Mar 25, 2024 · 2 comments

Comments

@hick209
Copy link

hick209 commented Mar 25, 2024

In my company here there are people that are running CliKt inside their test flavor of our Android app, which they use to validate things in some e2e tests we run.

Mordant is a dep of CliKt and it currently does not support Android.

Here is our stack trace of the issue we run into during our test runs with Mordant 2.0.0:

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.load(Native.java:596)
  	at com.github.ajalt.mordant.internal.LinuxMppImpls.<init>(JnaMppImplsLinux.kt:44)
  	at com.github.ajalt.mordant.internal.MppImplKt.<clinit>(MppImpl.kt:97)
  	at com.github.ajalt.mordant.terminal.TerminalDetection.isIntellijRunActionConsole(TerminalDetection.kt:169)
  	at com.github.ajalt.mordant.terminal.TerminalDetection.detectTerminal(TerminalDetection.kt:16)
  	at com.github.ajalt.mordant.terminal.StdoutTerminalInterface.<init>(StdoutTerminalInterface.kt:17)
  	at com.github.ajalt.mordant.terminal.Terminal.<init>(Terminal.kt:56)
  	at com.github.ajalt.mordant.terminal.Terminal.<init>(Terminal.kt:45)
  	at com.github.ajalt.clikt.core.Context$Builder.<init>(Context.kt:227)
  	at com.github.ajalt.clikt.core.Context$Companion.build$clikt(Context.kt:312)
  	at com.github.ajalt.clikt.core.CliktCommand.createContext(CliktCommand.kt:141)
  	at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:487)
  	at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:486)
  	<our code>

I've looked into the code whether the latest available version and even master would have a fix for this issue, but unfortunately it would not help our use case 😕

@ajalt
Copy link
Owner

ajalt commented Mar 25, 2024

To be clear, based on you stack trace you're asking about Java on android, not any of the androidNative targets?

The first google result for your exception suggests that you may need to manually add a dependency on the aar artifact implementation("net.java.dev.jna:jna:5.13.0@aar"). Give that a try.

@hick209
Copy link
Author

hick209 commented Mar 25, 2024

Yes, that's correct, Java on Android.

Thanks a log for pointing it out that this could be a dep issue on our end, if so I apologize the churn.

I know we do have that library as a dep, but maybe we strip it out at some point, because the final .so didn't make into the APK, that I'm certain of.

Let me try some things out here and I'll update this issue with the results.

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

2 participants