How to start running applications in C ++ in android?

How to run C ++ applications in android using cygwin. Any textbook in this regard is welcome.

+6
source share
2 answers

You cannot directly run C ++ applications on Android.
Android can only run applications written using the Android SDK, but yes, you can reuse your native (C / C ++) libraries for Android.

You will have to recompile all the native libraries specifically for Android. And you need the source code for all the third-party native libraries that you plan to use simply because usually when we compile and link these libraries outside of Android, they are linked with glibc, but unfortunately Android does not use glibc because of problems with liscence and performance. Android uses a waterlogged version of glibc called libc. It has matching symbol names for glibc for most common functions. But as far as I know, libc does not have some string related functions, and it definitely does not have posix support. If your own libraries use any outdated functionality, you will have to find a workaround for those using alternative functions supported by libc and encoding your libraries accordingly.

In addition, you will need to use the NDK for the Java interface (Android app / fwk) with the native world (C ++). And then write an Android app on top of that.

Despite the fact that it is very simple in my experience, compiling native libraries on Android (porting Android) has traditionally taken a lot of time without any guarantee of success.

+8
source

You will need a Java Native or JNI interface.

See: " Java Native Interface Wiki " " Android JNI Tips " and the links in it. It is a definite job to achieve this and get used to how it happens. I managed to get this from the links given here with C , and it will work after some time and faith without any additional help if you follow all the steps.

0
source

Source: https://habr.com/ru/post/889180/


All Articles