What is the definitive/official situation regarding native development/JNI?

0 views
Skip to first unread message

fructose

unread,
Feb 4, 2009, 3:18:53 PM2/4/09
to Android Discuss
I would like to know what the definitive, hopefully official,
situation regarding native development.

Whenever anybody posts a question regarding native development the
stock answer that is given is "There is no support for native
development".

I simply want to know the answers to:
1) If I want to write/port a C/C++ application engine and write a Java
App that accesses it, how can this be achieved?


2) If this is not possible, will it be possible in the future? If so
when?


3) Is this is not possible, is it only not possible for 3rd party
developers? If I am a hugh corporation, suppose I'm SAP or Oracle, or
a major international games developer and have multi-million selling
products in C/C++ that I wish to port to Android, are Google going to
tell me sorry its not possibe? Are they really going to say that? If
not then who do you talk to in order to open doors?

David Turner

unread,
Feb 5, 2009, 3:39:41 PM2/5/09
to android...@googlegroups.com
On Wed, Feb 4, 2009 at 9:18 PM, fructose <david_p...@hotmail.com> wrote:

I would like to know what the definitive, hopefully official,
situation regarding native development.

that's easy, writing third-party apps containing native code is *officially* *not* *supported*.
Which is our way to say that if you do it, don't be surprised if your app breaks due to system
changes or have weird support issues.

(Note that this is different if you are directly poking at the framework code to prepare a new
Android-based system/product).
 

Whenever anybody posts a question regarding native development the
stock answer that is given is "There is no support for native
development".

I simply want to know the answers to:
1) If I want to write/port a C/C++ application engine and write a Java
App that accesses it, how can this be achieved?

this is possible through clever hacks that won't be described here because these apps
are very likely to break in one of the next release of the platform.



2) If this is not possible, will it be possible in the future? If so
when?

We are preparing a Native Development Kit that will allow you to embed native libraries in your
application that your Java app will call through JNI. However there is a catch: the set of system
interfaces your C/C++ code will be able to call will be very strictly limited (e.g. libc + libm + jni.h)

Any attempt to call one of the system libraries like Skia, Webcore and other will fall under the
*unsupported* case and *will* break in future releases of the system.

The set of supported NDK native interfaces might gorw a little to include stuff like OpenGL in
the more distant future, but will always remain very limited by design. That should be enough
for many games and signal-processing apps.



3) Is this is not possible, is it only not possible for 3rd party
developers? If I am a hugh corporation, suppose I'm SAP or Oracle, or
a major international games developer and have multi-million selling
products in C/C++ that I wish to port to Android, are Google going to
tell me sorry its not possibe? Are they really going to say that? If
not then who do you talk to in order to open doors?

If you are a large corporation, just use the Android sources to build your own system
and distribute them to your employees and/or customers. Of course you'll also do al
the support. However, your native apps will probably not run properly on other
Android-based systems.
 



fadden

unread,
Feb 5, 2009, 3:48:58 PM2/5/09
to Android Discuss
On Feb 4, 12:18 pm, fructose <david_prest...@hotmail.com> wrote:
> I would like to know what the definitive, hopefully official,
> situation regarding native development.

I can't speak definitively or officially, but I can make some
observations.

> 1) If I want to write/port a C/C++ application engine and write a Java
> App that accesses it, how can this be achieved?

Well, you can do it like this person did:

http://code.google.com/p/mandelbrot/

There are some pages on the web that explain various bits and pieces.

This is not a supported mode of development, which really just means
that whatever you do is very likely to break the next time the system
is updated. The changes required to make your stuff work again might
be minor or might require a redesign. If you really want to go this
route, there are no mechanisms in place to stop you.

> 2) If this is not possible, will it be possible in the future? If so
> when?

Native development will be supported in the future. No details or
schedule have been announced.

> 3) Is this is not possible, is it only not possible for 3rd party
> developers? If I am a hugh corporation, suppose I'm SAP or Oracle, or
> a major international games developer and have multi-million selling
> products in C/C++ that I wish to port to Android, are Google going to
> tell me sorry its not possibe? Are they really going to say that? If
> not then who do you talk to in order to open doors?

Large companies and individual developers all have access to the same
source code in the git repository. There is no secret installer or
hidden build system.

We are, at this time, recommending that you don't do native code
development. It would be inconsistent and counter-productive to say
that and then spent lots of time explaining how to go about it.
Reply all
Reply to author
Forward
0 new messages