-
Notifications
You must be signed in to change notification settings - Fork 54
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
Android, can't use library #23
Comments
Hi, thanks for reporting this. I believe this is an issue with how the library is trying to detect what architecture of native library to use. It tries to use what it got from the system property We should add some aliases in H3CoreLoader to handle common architecture names on Android. We should probably also expose an API for the user to specify the OS/architecture to use in case the automatic detection doesn't get it right. |
Hi Isaac and thanks for your response. I see, but I don;t want to build the h3-Java library at least for now to add aliases in H3CoreLoader. Also I tried using newSystemInstance() method that loads library directly and I get another exception: Thanks. |
@NickRadu that doesn't sound right - what version of h3-java are you using? Could you try 3.0.4? There should be a directory |
@ isaacbrodsky I'm using already version 3.0.4. |
I experimented with a test Android app, and was able to get it working with I faced an issue like you mention where only the windows-x64 and windows-x86 native libraries are copied into the APK (I didn't get darwin-x64 copied.) Without repackaging H3-Java as an Android library, I was only able to work around that by using the Unfortunately this did not work as loading the library failed with an exception very similar to yours: I'll update my PR with the change to link to libm, and a couple fixes for accessibility (especially of H3CoreLoader.) In the future, we might want to package an H3-Java specifically for Android, which might help with the need to copy the native library into your project. |
Hi Isaac, Great news, thank you for help. Do you have any ETA for this fix? Thank. |
Hi, the fix for libm should be included in the v3.1.0 of the H3-Java library. |
Hi Isaac, thanks for the fix. |
I'm using version 3.2.0 and still getting UnsatisfiedLinkError with |
Hi, I think the missing part is the native library resource being copied into the Android application. I'll leave this issue reopened to track that. Could you try the above steps of copying the native library files into the |
where do I find |
@yterletskyi You can find the resource files |
any updates on this? |
Hi, I don't have an update on packaging the library for Android. Could you check if the files are copied to the APK? I needed to add specific build option ( |
The cross compiling system we use (Dockcross) doesn't seem to offer an android-x86 option, so I assume we do not currently support that. Could you try running on ARM with the workaround posted above regarding copying the |
I still get the error |
Solved by using |
i have copied the whole library folder to do i need to reference something in |
Hi everybody, I'm already added |
I also came across this issue. I was able to manually load the *.so by adding the Then I set a breakpoint on line 67 in
After starting the app in debug mode, the breakpoint is hit and the debug console appears. I had to set the
Where |
Rename your I just managed to make the library work on my end myself. I added a StackOverflow answer here: Here's a sample project |
I'm having the same problem has anybody got a solution to |
armeabi, armeabi-v7a, arm64-v8a are ABIs supported in Android and this library doesn't support for x86 and x86_64 In your case, android-armv7l doesn't look like regular ABI for Android device For regular Android deviceCurrently all android devices running on ARM (Except outdated device like Asus ZenPhone 5 and Chrome OS device). x86 and x86_64 are available in Android Emulator only. So you can config your app to support ARM only in android {
/* ... */
defaultConfig {
/* ... */
ndk {
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a"
}
}
} |
I also faced this issue, @yelsane solution worked for me, thanks. |
I am facing the same problem. Got it working but after a Android Studio update it failed to work for me. Is it possible to fix this without the need for a workaround. Would be very nice :) |
@mrQuidome What are the minimum and target android API's in your project? |
Started all over again and have it working (again). That's very nice. But, the problem was something different. It works when I run it on my device It does not work when I use the emulator. Somebody an idea? |
@mrQuidome What architecture is your emulator using? When I had issues it was because the libh3.so didn't match the architecture of my emulator. If you're using the JNIlibs/libh3-java.so approach one thing you could do is make sure you have a libh3.so copy that is built for your emulator architecture (x86,arm,arm64, etc) |
Thank you for your reply :) |
@yelsane did you change so files? It does work if using your so files in your demo project. But when I used so files in h3-3.7.1.jar or h3-3.4.1.jar it didn't work. H3Core.newInstance() throws error: java.lang.UnsatisfiedLinkError: dlopen failed: library "libh3-java.so" not found. |
I'm using 3.6.2 and it's working. |
@ben-ying it's been a while since I touched this lib, but with regard to the h3 files, I didn't change anything. I just used them as is. |
Using library 3.7.1... I can confirm that copying the library android jni files to the analogous android project jniLibs folders and using the newSystemInstance() call works, mostly - until we encounter a 64-bit android device. On those devices, I can further confirm that the library fails to load with aforementioned, cannot locate symbol "lroundl", error. Update: |
I am facing the same issue when using this lib (3.7.2) in my project. I am still get the following error:
using older *.so files from e.g. @yelsane 's sample project works somehow. |
Ok... It worked for me because I was using H3 together with Mapbox SDK. It forces using |
Something is weird about this lib in android apps. It packages *.dlls and *.dylibs but no *.so files. |
Any plans to support Android in the future? I could not get v4 nor v3 to work with the latest Android development libraries, tried all suggestions above. |
same here, any alternatives? |
add to app build.gradle Works fine with x86 emulator API30. |
Hello! |
How I can use this library in Android oS?
I got following exception:
java.lang.UnsatisfiedLinkError: No native resource found at /android-armv7l/libh3-java.so
at com.uber.h3core.H3CoreLoader.copyResource(H3CoreLoader.java:67)
at com.uber.h3core.H3CoreLoader.loadNatives(H3CoreLoader.java:99)
at com.uber.h3core.H3Core.newInstance(H3Core.java:68)
Thank you.
The text was updated successfully, but these errors were encountered: