Open RGregat opened 3 weeks ago
Here is an interesting SO about the issue (https://stackoverflow.com/questions/11491065/linking-with-versioned-shared-library-in-android-ndk).
In a nutshell, Android has problems to pack versioned *.so files.
Prebuilt native libraries need to be placed on src/main/jniLibs/ABI
directory, currently they are installed on $INSTALL_DIR/lib/
, e.g GDAL4Android/gdal/cpp/.install/aarch64-linux-android/lib/ , and this is already done with https://github.com/kikitte/GDAL4Android/blob/110f22c03ef9cce14135979c83a75a49044b2041/gdal/build_cpp.sh#L218-L222
Here is an interesting SO about the issue (https://stackoverflow.com/questions/11491065/linking-with-versioned-shared-library-in-android-ndk).
In a nutshell, Android has problems to pack versioned *.so files.
Sad. May be we need to move libgeos_c.so.1 to libgeos_c.so manually in $INSTALL_DIR/lib/ after geos is installed, so gdal will use libgeos_c.so. Or any methods to produce non-versioned so file may solve this problem too, e.g modify geos build script?
This might be one solution. Another one, I stumbled upon my research, is patchelf (https://github.com/NixOS/patchelf). Both options are feeling hacky :)
Cheers, thx for your work. I was able to create a .aar file with the Docker-Setup. If I add the .aar file to a brand new Android-Project I get the following error
libgdalalljni.so
is missing.Adding
cp $INSTALL_DIR/lib/jni/*.so $ABI_JNI_DIR
to thebuild_cpp.sh
and re exporting to .aar lead to the next error. This time islibgeos_c.so.1
missing. Which is of course out of the scope of this repository, because you have not included geos. I tried to add them in thebuild_cpp.sh
but for some reason this file is not added to the resulting .aar.