Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411517 Posts in 69377 Topics- by 58431 Members - Latest Member: Bohdan_Zoshchenko

April 28, 2024, 01:10:32 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Android Native Development?
Pages: [1]
Print
Author Topic: Android Native Development?  (Read 3209 times)
mcc
Level 10
*****


glitch


View Profile WWW
« on: December 01, 2009, 09:21:30 PM »

So I had been assuming Android development was basically out for me because my existing code is primarily in C/C++ and I was under the impression Android is Java-only. However what I have learned is that apparently a "Native Development Kit" for Android exists now which allows you to use JNI in an Android application. Does anyone know anything about this, or have any experience with it?

There is an article about the NDK here, which does not seem to say a lot but does seem pretty down on it. Google appears to be discouraging its use and does not provide access to "platform framework APIs", though it's not clear to me what this means. I would be curious what kinds of APIs you do have access to within native code (OpenGL ES? Standard C functions like fopen() and ifstream? Any POSIX stuff?).

The iPhone has this thing where the OS APIs are all in Objective C, but in practice this technically only means you have to write a few pages of objc glue to handle things like screen input and sleep/wake events and shuttle the results to your C code. Would porting a game to Android using the NDK be sorta like that, or is this more like the unmanaged code thing in .NET where you are basically in jail and have to make expensive calls back into managed code to do even basic things?
Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
slembcke
Level 3
***



View Profile WWW
« Reply #1 on: December 02, 2009, 08:21:44 AM »

From what I can tell from talking with a couple Android devs at the last IGDA meeting, thing like important multimedia functionality is exposed (OpenGLES, sound, etc). It sounds like that's largely the point of the NDK is to allow better performance at demanding multimedia tasks like that.

The big problem with the NDK is that Android phones have no hardware specifications. I don't know if that is official exactly, but the Android devs certainly seemed wary of the NDK for that reason. That is why they built everything on top of a Java interpreter. You might get a ARM with an FPU or without, it might be an Atom... You get the idea. Even now, if you are going to use the NDK, you pretty much have to target the bottom line anyway, which is to assume that you have no FPU (I think the Droid is one of few exceptions that have one) and need to do everything in fixed point.

You also have pretty much the same problem when targeting GPUs. You basically have to assume that you can't use compressed texture formats or other extension based functionality. Even worse, a significant portion of Android phones have no GPU at all and fallback on software based rendering.

At this point, you can't be surprised that you have the same problem with input devices... You can't really assume that it will have anything beyond a touchscreen from the sounds of it. Keyboards, accelerometers, d-pads, multi-touch are all optional.

The real bummer is that there is apparently no way to flag what functionality your app needs in order to run. So if you are trying to do something fancy, your users have to buy your app only to find out that they can't use it. While the iPhone app store is very crowded and cut-throat, the Android marketplace sounds more frustrating that the PC market of the early-mid 90's where you had to support a bajillion different hardware configurations in your game.
Logged

Scott - Howling Moon Software Chipmunk Physics Library - A fast and lightweight 2D physics engine.
mcc
Level 10
*****


glitch


View Profile WWW
« Reply #2 on: December 03, 2009, 11:25:29 PM »

That's extremely interesting, thanks.

Do you know, is there at least a software FPU library on the models that don't have an FPU proper, such that you can at least haul off and use floats and it will at least work even if it's inefficient?

I'd be curious, is it known what the "least common denominator" for Android phones is? Like if I test on a G1 am I pretty much safe?
Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
slembcke
Level 3
***



View Profile WWW
« Reply #3 on: December 04, 2009, 07:35:55 AM »

Yeah, you can still do floating point math, the compiler just has to generate code to do the floating point stuff using integer math instead. I remember way back in the day there were programs that could conditionally take advantage of an FPU, though that was before I did any serious programming. No idea if you can easily do the same with GCC.

I am not an Android developer, so I'm not quite sure about what the lowest common denominator is exactly. I do know that there are phones with smaller screens and no GPU like the HTC Tattoo. The guy at IGDA had one for testing and it looked like it could barely run basic 3D stuff as it was using software rendering. I'm not sure if small screens and no GPU will become common though.
Logged

Scott - Howling Moon Software Chipmunk Physics Library - A fast and lightweight 2D physics engine.
Jews32
TIGBaby
*


View Profile
« Reply #4 on: December 17, 2009, 03:23:49 AM »

Where do you find the Android Native Development ? I have downloaded MOTODEV studio for Android on Linux but can't find any NDK here neither gcc/toolchain...
 
Thanks for your help.
 
Stephane.



______________________________________

luxury pet carriers | flexible mouldings | bowsers dog beds
« Last Edit: December 21, 2009, 03:40:49 AM by Jews32 » Logged
YagerX
Level 2
**



View Profile WWW
« Reply #5 on: December 21, 2009, 03:53:53 AM »

______________________________________

luxury pet carriers | flexible mouldings | bowsers dog beds

Just me or did spambots just get smarter?
Logged

Sar
Level 3
***


Likes Violins


View Profile WWW
« Reply #6 on: December 21, 2009, 09:46:39 AM »

Just me or did spambots just get smarter?

It's just you. ;-)
Logged

Currently working on: Chronicle of Mars
Previous Projects: [Käfer|Tristan and Iseult(TIGS)]
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic