Using cUrl with android on devices with different architectures - android

I would like to use native library cUrl in my android project, but i'm afraid that there could be problems with different architectures.
I'm new to NDK, so it would be great, if you'll help me with that question.
Thanks in advance

If you are going to include a native library in your Android application, you need to build it for all possible architectures like arm, x86. If you don't your application won't work on devices that you don't provide builds for and also they won't be visible in Google Play for those devices. However within those architecture builds you are safe.
Android NDK provides all the necessary support to get you covered in this scenario, so you should start from reading there.

Related

How to use Linux app in android

I have created a app for Linux system. Now I want to developer similarly into Android devices.
I searched everywhere but didn't get result. So please expert which way do i need to use?
You need to look at the Android NDK docs. The NDK (Native Development Kit) is used to integrate native components into the Android world.
It is based on Makefiles providing you with the ability to build your native components using the provided toolchain.
It is then possible to build your components into different outputs (namely, shared libraries, executables ...).

Developing native C applications android without the NDK?

OK this is a strange one:
Is there a way someone can develop native C applications or libraries for Android without using the Android NDK?
What was happening before the NDK was released?
(It's not there for too long, I think it was released only one or two years ago).
Apparently, you can -- a friend of mine is a real Android guru and he managed to build a GCC-based native toolchain entirely by hand. He also fixed some missing parts in Android's libc. The main idea is the following: GCC has builtin support for the arm-elf-linux target, so with an appropriate build script, you can configure it to build for Android. However, you have to root the phone to run the resulting binaries. One even cooler thing is that because GCC is a self-hosting compiler, with the arm-linux-elf toolchain, you can recompile GCC once again and have the toolchain on the phone itself.
Before the NDK was released, the only officially supported way of developing Android applications was to use the Android SDK and writing your applications in Java.
As others have mentioned, it's possible to cross-compile some applications as completely stand-alone and run them on a rooted phone. The downsides of this should be obvious: very few people will be able to run your application (they also need to be root, plus you won't be able to get your application up on the Play store); and you might even run into compatibility problems yourself across different devices e.g. if you rely on dynamic linking against various libraries (which you might need to do in order to keep the size of the binary down).
TL;DR: it's possible, but severly limited, and not recommended.
You can compile your C code with an Android-compatible toolchain (such as CodeSourcery) and run it on a non-rooted phone, from its command line (for example through an SSH connection like SSHDroid).

DynaPDF Compatibility with Android

I am looking to use the DynaPDF in my Android project as a C library. However on the downloads page the only option I can see that could be used is "DynaPDF for linux for x86 (32)", as I understand it x86 is based on architecture where as Android use ARM architecture. I am quite new to native programming and so would appreciate if somebody could confirm was I guess or explain another way to implement the library.
To port the library, you must have access to the sources (the download page of DynaPDF has links to the compiled libraries, which is not very useful).

Android NDK doesn't include ltdl

I'm trying to build a linux library for Android, but it seems that libtool for the android gcc toolchain doesn't include ltdl, the dynamic loader. Is there a system-related reason for this, or is it just not there?
How would I go about incorporating the ltdl from www.gnu.org/software/libtool/ into an android build?
Thanks!
Many of the standard libraries are 'missing' from the Android NDK most likely for technical reasons of which I am not aware. I do believe in the release notes for the NDK there are entries for those standard C libraries which are not currently incorporated there might be a mention in there as to why ltdl. I can only suggest to get the source and create an Android NDK project and build it that way. Although may I ask why you need the dynamic loader.. android loads libraries as required anyway (so I understand in my limited knowledge)

How to get libcap (Linux capabilities library) for Android?

Are the Linux capabilities (libcap.so) library available for use with Android? If not, how can I compile it?
I would like to use the capabilities-related API in sys/capabilities.h, which is included with the NDK. But when I try to call functions like cap_get_proc(), I get "undefined reference" error.
I would imagine that using this api would go way, way beyond the contract in the Android framework. It might work on some devices, but not on others.
In fact, there's no guarantee, afaik, that Android even runs under Linux. For example, the new Blackberry devices run Blackberry's proprietary OS, but still run Android apps.
Finally, the version of Linux that most Android devices run is a highly-stripped-down version. They didn't include any features that the Android API doesn't need. If Android doesn't need libcap, then it's probably not included.
Perhaps you could tell us exactly what it is you're trying to do.
Here is the link - https://github.com/scopichmu/libcap-for-Android. This is original libcap (was cloned from https://kernel.googlesource.com/pub/scm/linux/kernel/git/morgan/libcap) with supporting of android ndk build. You can build now libcap.so, setcap and getcap for android.
Lots of discussion out there on this topic... google around a bit:
http://permalink.gmane.org/gmane.comp.handhelds.android.ndk/4075
Here someone compiled it and described:
http://blog.umitproject.org/2011/05/libpcap-for-android.html

Categories

Resources