7

I want to port an aplication written in C++ to android. Converting the application from C++ to Java will take a lot of work that I would prefer to use on making the application better for that platform instead of fixing convertion bugs and solving refactoring problems.

The NDK seems a good route to take but actually I don't want to miss a platform(if it is a considerable % of the market) just because the NDK doesn't or won't support it.

Android claims to support MIPS, ARM, X86 and others ... but actually all the implementations I have seen are only on ARM (or arm compatible). I checked that on this site: http://www.pdadb.net/

Would it be a bad desision to use the NDK?
Are there any non ARM devices that run or will run Android?
Where can I find more information about this?

Thanks in advance!

3
  • 3
    well, it should be only a matter of compiling to a different arch if and when someone actually runs android on a different arch. Unless you are using inline asm or something.
    – ewanm89
    Dec 20, 2010 at 13:42
  • so did you complete your game? I would love to play it.
    – AZ_
    Mar 2, 2012 at 8:03
  • also please share the solution you adapted
    – AZ_
    Mar 2, 2012 at 8:03

4 Answers 4

5

At this point the problem is not that you would not lose market share due to CPU architecture, as there are very few non-ARM Android devices at the moment, the problem is that you may lose market share due to requiring users to run Android 2.3 or later, which you would have to use in order to create a fully native application with access to the window, sensor, and input subsystems.

Avoiding rewriting code is a good goal but you would likely have to rewrite portions of the code anyway due to Android's dissimilar Window and life-cycle APIs. Now you would have to rewrite some important parts of the code in C++ rather than in Java.

You could try a hybrid approach where you write most of the UI in Java, then make calls to your existing C++ code.

Are you making a game? Then you'll probably want to deal with these issues and press on with the NDK. If not, try implementing as much of the program as possible in Java and use the NDK for the complex, tested parts of your code that need to be fast.

2
  • Yeah! It's a game. Forgot to say that :P Basically I will do the OpenGLES/Sound and system calls in Java. But I don't want to touch the C++ code because it will requiere lots of work just to convert it. My plan is to work with Android 2.1 which seems will be more than 95% in a couple of months (probably I will be OK supporting 1.6 as well) My fear is to have to redo the game in java in 6 months ... how can I be sure I will be OK?
    – user548569
    Dec 20, 2010 at 21:05
  • Sadly, I can't say for sure that you'd be OK, but I'm pretty sure you won't suddenly find yourself re-writing it all in Java. Plus, as it says in the NDK documentation "You can also build for both [ARM] architectures at the same time and have everything stored in the final .apk." So you'd be set for the foreseeable future. Good luck!
    – Nate
    Dec 20, 2010 at 23:02
3

The documentation gives the following:

The latest release of the NDK supports these ARM instruction sets:

ARMv5TE (including Thumb-1 instructions)
ARMv7-A (including Thumb-2 and VFPv3-D16 instructions, with optional support for     NEON/VFPv3-D32 instructions)

Future releases of the NDK will also support:

x86 instructions (see CPU-ARCH-ABIS.HTML for more information)
2

Would it be a bad desision to use the NDK?

For algorithms, the NDK is fine. For games, the NDK is fine. For implementing an ordinary app, the NDK will not be terribly helpful.

Are there any non ARM devices that run or will run Android?

Google TV runs on x86 (Atom).

1
  • @richq: Um, yeah, that was pretty bad. I clarified the answer. Thanks for pointing it out! Dec 20, 2010 at 21:53
1

Use this improved NDK: http://developer.mips.com/android/download-android-ndk/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.