1

I'm investigating porting a C++/Win32 project of mine to work on Android devices. I have not developed anything for Android before, although I have developed on a number of Unix OS's and Linux in previous jobs. I've looked at a lot of information while trying to find a good, free cross-compiler (compile on Windows, target is Android), but I keep finding extremely strange and confusing answers about Android not supporting C++ and having to rely on Java even if I use a tool to make the C++ code work. That doesn't make any sense to me at all since C++ is just the language choice, not the API, and what I need is any API and compiler to support creating a binary for this particular OS. I find it difficult to believe that there's no true C++ compiler and some API that would work with it.

So that's my question: Am I misunderstanding all this information about no true C++ compiler and compatible API for the Android OS and that any C++ code has to rely on Java? If so, what is a good, free choice that does not rely on Java? And what is a good API for that? If I'm not misunderstanding, then why is there a dependency on Java and does no one ever build native binaries?

More detail:

At the very least, it seems like gcc should work. I'd just go with that, but apparently people were having some problems with it on Android and therefore the build options looked like a hassle. Plus I was hoping for something a bit more user-friendly where I don't have to spend a lot of time dealing with makefiles and such.

To add a bit more detail about my specific case, this project is extremely large and therefore it is not feasible to rewrite it in another language. It needs to be efficient, which is why I want it to compile into a native binary just like it does on Windows now. I designed it at a very low level that uses a very small number of very basic Win32 commands and isolated those in a windows-specific layer for any future porting purposes (so exactly this situation), so I really just need a very few, very basic API functions. On a previous job, we used to do this very thing for the products to support both Windows and a variety of Unix OS's (Solaris, HP-UX, etc.) and Linux, so I was planning on taking exactly the same approach here. I'm not at all clear why the Android OS would be any different.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
ag87
  • 19
  • 3
  • 1
    Did you at least find this in your research: https://developer.android.com/guide/platform/index.html and https://developer.android.com/guide/components/fundamentals.html – Morrison Chang Jan 14 '17 at 03:55
  • Also: http://stackoverflow.com/questions/1002164/write-applications-in-c-or-c-for-android – Morrison Chang Jan 14 '17 at 04:02
  • Thank you. From the sounds of it, Android is designed to force all programs to use Java (for some reason) unless you take special steps to go around it. That would seem to imply that C++ programs typically do in fact rely on Java. If I am understanding that correcly, is that the typical recommended route (to allow C++ code to use Java)? Or is it common to take the steps to go around this? – ag87 Jan 14 '17 at 04:27
  • As I do more reading on these pages, I think the answers to these follow-up questions are becoming clear. Thanks again for your help. – ag87 Jan 14 '17 at 04:41
  • You should read or search [android.se] for more information. – Thomas Matthews Jan 14 '17 at 06:03

0 Answers0