1

I don't know whether i make sense or not. But just wanted to now that can i run the c/c++ code in android without the need of writing JNI wrapper or using Native Activity way?

I mean, I am having a simple C++ Template Matching code which contains main function and I use to run it using g++ in terminal.

Now I want this Template Matching code to be run in android usng NDK. Is there any way? I have googled a lot but all they is to either use JNI wrapper or use SWIG which makes JNI wrapper, but can't actually get into any of them. I need more simpler solution.

1 Answer 1

2

If you have a rooted phone, you can compile and run programs as on any linux machine, from the adb shell.

However, that requires a bit of knowledge about Linux.

So, to start:

  • Root your phone (force it to give you admin privileges). That is easy for developer phones/boards, and a kill for regular phones bought at a shop downstreet.

  • compile your app for android and run it from adb as you would do from a linux shell.

Here is a more detailed answer on the matter

How to compile C into an executable binary file and run it in Android from Android Shell?

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot..Happy to now that there is a way..I am surely going to try it out..and if it works out..this is going to be best answer :-)
Google for instructions on your specific model. For some models there is no info available, for others you need to do a bit of hacking, and for a few of them is as simple as restarting in admin mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.