I want to use this command
ogr2ogr -f "GeoJSON"
to convert .TAB file to json
but I want to do this in Android so I want to build this library for android
I found this link
http://trac.osgeo.org/gdal/wiki/BuildingForAndroid
but I am wondering if there is any existing built library or any sample ?
I read the .DAT file using
nl.knaw.dans.common.dbflib but I need to read .MAP file also, How can I do that ?
I have just done the build for Android (arm/x86) and the guide that you are pointing to is accurate.
I did a fair amount of searching and did not find pre-compiled libraries. It would be awesome if it could be included in cpp-to-java projects like https://github.com/bytedeco/javacpp-presets
Regarding filetypes: I have not seen examples of using .DAT or .MAP files in an Android project. You would normally look for static (.a) or dynamic (.so) libraries, or JAR/AAR java/android libraries.
Note that for a native library to work it needs to be compiled for the specific architecture that you are targeting with the app - e.g. armeabi-v7a or x86. See https://developer.android.com/ndk/guides/prebuilts.html
Related
I have looked at Use prebuilt JNI library in Android Studio 3.1 and How to use .so in a second project in Android?. The first is trying to get a library file without headers working and the other seems to be focusing on a specific issue with his build (although there's some useful information there). I'm relatively new to app development and especially to native development on android. I've gotten a build with the JNI library and some c++ code working, but that seems to be just for building from source.
It's probably a simple answer, but I haven't been able to find documentation on this specifically in the android developers documentation. I'm interested in understanding the correct (or most conventional) place to put and way to use a precompiled library (module/lib/*.so and module/include/*.h) in an android project. Would I even need to use JNI or the NDK if the library is built with another build tool? Another project I have has a native library source object (*.so) in ./obj/local, ./libs, and in many other folders related to JNI. I'm guessing it would be somewhere in there, but I'd like to know what is conventional.
For some context, I'm trying to work with the essentia library. I have followed the guide on compiling for Android and have a build with the general hierarchy mentioned above (essentia/lib and essentia/include) that seems to be working.
I am currently working on an android project that requires me to make use of functions included in a shared library (.so). I also only have header (.h) files for the library provided to me.
Is it possible to work with just these two files? Or do I need to create my own implemenations via c++ codes?
I am using Android Studio intend to use CMake.
Regards,
Philip
Most Android apps are written in Java. Google has released the Native Developer Kit (NDK) in order to allow developers to write libraries in C++. However, these libraries are usually very low level and called from the Java code which defines the UI and higher-level app logic. Most likely you will need to write a wrapper for the library so that you can call it from Java code. Looks like this blog is a good place to start.
I'm trying to integrate this specific library to my Android project, and the library is written in C/C++. I've miraculously gotten ndk-build to give me the needed .so file.
However, looking at it, there's a sample in the project, and they use a mysterious .jar with the API bindings of the .c/c++ files.
How do i either
create this special .jar file that has the API, based on the .so?
OR
directly add a method to the main c++ file and then call it from Java?
I've tried to re-wrap things using JNI, but it definitely doesn't seem to work. i keep getting UnsatisfiedLinkError.
A lot of the documentation online uses jni as the tutorial. i'm happy with just a few links to tutorials on JNA.
JNA provides a stub native library, libjnidispatch.so for a variety of platforms. You can build this library yourself, or extract one of the pre-built binaries from the project's lib/native/<platform>.jar packages.
You include libjnidispatch.so in your Android project the way you would any other JNI library. This is required; you cannot rely on JNA to dynamically unpack and use its native library automatically like on other platforms. The JNA project includes details for doing so (as well as instructions for building libjnidispatch.so yourself).
You then use jna.jar as you would any other Java jar file, and write your own (Java) mappings to match the native library you're trying to access. There's also a jna-min.jar which omits all the native platform libraries that are normally bundled in jna.jar.
Do go to project properties and build paths and remove JNA 4.0 and related classes.
This will work!
So , I have installed Ubuntu(but still use the Android kernel) on my Android phone with the intention of using it to compile native code for the device using the glibc.
I made a library, which I plan to use it in an app which I want to make, using JNI, but I am using the math library. My question is:
Is there a way to include these libraries into the library that I
created so that my phone can use the glibc library instead of the
bionic(which is what the NDK uses) library?
NOTE: I have tried making a test program that uses the library and statically links to make sure that the compiled code would work on the android OS and not just Ubuntu, and I came to the conclusion that it does :) So any answer pertaining to my question would be a great help.
You can use ar to extract the original .o files from any .a files:
ar x libm.a
You can then select whichever .o files you like and link them into your own code.
.a library files can be viewed as tar files with extra symbol-index features (although I don't know how similar the internals are).
WARNING: in general, you can only use .o files from static libraries in your main application. If you try to link them into a shared library (.so file) you may be out of luck. The .o file needs to have been created with -fPIC for that to work, and this is often not the case for static libraries.
I want to write an Android application that is able to display list of exported functions by a shared library (.so).
nm/objdump/readelf tool is only available for Windows/Linux. So I have thought about compiling platfor_external_elfutils to get a toolchain with nm or objdump tool.
However, this is not a good solution considering the big dependencies the toolchain may cause (can be up to xx MB).
I want to ask if there is any available simple code to achieve the purpose without having to compile and attache the whole toolchain in my app.
This is probably too late for the original poster, but libelf can be built as a static library (libelf.a) from Android sources, at least since JB4.2. Just use
make libelf
In the main directory to build it.
If someone knows how to build it as a dynamic library/shared object that would be much appreciated.
You can use libelf library (from elftoolchain - it's BSD licensed) to parse the binary. libelf comes with source for elfdump utility that dumps various information about ELF file including export list. Just strip out the source you don't need and you're ready. Executable for this won't take more than 100KB.