Usage on the Android devices #69
-
Hello, I was able to succesfully compile PROJ 9.x + PROJ-JNI 2.0 library.
Problem As I'm not well skilled with C code, I'm still unable to find out why and where this happens. Appreciate and help, thanks!
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
I do not really know, since I have few experience in Android development. The Android API documentation suggests that this method exists and has the expected signature. There is a test that we could do. In the jclass c = env->FindClass("java/util/logging/Logger");
if (c) {
java_method_log = env->GetMethodID(c, "log", "(Ljava/util/logging/Level;Ljava/lang/String;)V");
if (java_method_log) {
c = env->FindClass("java/util/logging/Level");
if (c) {
java_field_debug_level = env->GetStaticFieldID(c, "FINE", "Ljava/util/logging/Level;");
if (java_field_debug_level) {
java_method_getLogger = env->GetStaticMethodID(caller, "logger", "()Ljava/util/logging/Logger;");
}
}
}
} Try to add another If it doesn't work, you can try to comment-out the whole above block. PROJ-JNI should still work with only logging disabled. |
Beta Was this translation helpful? Give feedback.
-
Amazing, thanks! You pointed to the correct place. When this block is commented, it works as expected (except that the PROJ has the problem to find proj.db, but this is a solvable problem). Thanks again for the help, I'm moving forward. |
Beta Was this translation helpful? Give feedback.
-
Alternatively I pushed a commit where I try to change the initialization order. This is only a guess, I have not idea if it has any incidence for Android. If you have a chance, would it be possible to test? Commit: 6be80ee |
Beta Was this translation helpful? Give feedback.
-
Hello, thanks, appreciate your help. Changes you made do not help here anyway, same error. I believe that the problem is in a different place. In Android, native libs are usually built by Android.mk where logger may be added by Anyway, as I wrote, with commenting problematic block, all seems to work for now and this is a sufficient solution for me for now. Thanks! |
Beta Was this translation helpful? Give feedback.
-
@menion would you be able to give any details about how you modified NativeResource to properly load the library? I am also trying to get PROJ JNI to compile for Android and am running into the issue where it fails to find my libproj-binding.so file. |
Beta Was this translation helpful? Give feedback.
-
how to implement this lib in the android app? Please give steps |
Beta Was this translation helpful? Give feedback.
I do not really know, since I have few experience in Android development. The Android API documentation suggests that this method exists and has the expected signature.
There is a test that we could do. In the
bindings.cpp
file, around lines 248 to 260 there is this code: