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

error on android #58

Closed
wakeee opened this issue Apr 25, 2018 · 5 comments
Closed

error on android #58

wakeee opened this issue Apr 25, 2018 · 5 comments

Comments

@wakeee
Copy link

wakeee commented Apr 25, 2018

get error on android 8.1, it seems can not find the so file.

byte[] bytes_c = Zstd.compress(bytes);

Process: **, PID: 32609
                                                   java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/
***
G2A1lahdmnHjLbIRu2ZjeQ==/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /product/lib64]]] couldn't find "libzstd-jni.so"
                                                   Unsupported OS/arch, cannot find /linux/aarch64/libzstd-jni.so or load zstd-jni from system libraries. Please try building from source the jar or providing libzstd-jni in you system.
                                                       at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
                                                       at java.lang.System.loadLibrary(System.java:1660)
                                                       at com.github.luben.zstd.util.Native.load(Native.java:69)
                                                       at com.github.luben.zstd.Zstd.<clinit>(Zstd.java:11)
                                                       at com.github.luben.zstd.Zstd.compress(Zstd.java:348)
                                                       at com.huawei.hiai.vision.mobilextest.MainActivity.compress(MainActivity.java:53)
                                                       at com.huawei.hiai.vision.mobilextest.MainActivity.onCreate(MainActivity.java:39)
                                                       at android.app.Activity.performCreate(Activity.java:7354)
                                                       at android.app.Activity.performCreate(Activity.java:7345)
                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1219)
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3110)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3268)
                                                       at android.app.ActivityThread.-wrap12(Unknown Source:0)
04-25 21:46:53.432 32609-32609/? E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1888)
                                                       at android.os.Handler.dispatchMessage(Handler.java:109)
                                                       at android.os.Looper.loop(Looper.java:218)
                                                       at android.app.ActivityThread.main(ActivityThread.java:7384)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
@luben
Copy link
Owner

luben commented Apr 25, 2018

Are you using it by importing zstd-jni in your project as a source sub-module or you are trying to reuse the Maven distributed JAR file? The later will not work.

@luben
Copy link
Owner

luben commented Jun 17, 2018

an aar is published on maven central for zstd-jni-1.3.4-10 and above, it should work now

@luben luben closed this as completed Jun 17, 2018
@carlos-mg89
Copy link

I'm trying to use this library using the following gradle line:

implementation 'com.github.luben:zstd-jni:1.4.0-1'

But I'm still getting the Unsupported OS/arch, cannot find /linux/aarch64/libzstd-jni.so or load zstd-jni from system libraries. Please try building from source the jar or providing libzstd-jni in you system. error.

Perhaps something else has to be done in order for an Android project to work well?

@carlos-mg89
Copy link

carlos-mg89 commented Jun 3, 2019

My bad, I forgot to add the 'aar' suffix on the implementation line. The correct and working line for Gradle is:

implementation 'com.github.luben:zstd-jni:1.4.0-1'@aar

It's working!

@htteng1976
Copy link

@carlos-mg89 thank you for mentioning the @aar is quite important for fixing the issue. You save my day.

For Android developers who now use version catalog in module dependency management, the following code would be helpful to load the zstd library.

In libs.versions.toml,
[libraries]
zstd = { module = "com.github.luben:zstd-jni", version = "1.5.6-5"}

In build.gradle,
implementation (libs.zstd) {
artifact {
type = 'aar'
}
}

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

4 participants