Android Native Development Anyone?

Started by
6 comments, last by lorem 11 months ago

Hey everyone, I'm curious what tools you are using to develop your custom engines/games in C++ for Android?

I've been away from gamedev for a few years but ready to jump back in and update my games which were both made with custom made C++ based engines. Back them, I was using Android Codeworks from nVidia which allowed devs to develop native C++ Android apps with Visual Studio with relative ease and even supported debugging with breakpoints but looks like it was discontinued some time ago and you can only build up to Android 9 (platform 28).

So now I've either got to hack it to work with later versions OR switch to something else. I've heard good things about Android Studio native development.

What are you all using?

None

Advertisement

Not a game development - but software (and yes, some include 3D graphics rendering).

I'm using Android Studio - I've toyed with native back in the day, but at this point not really much of native code anymore (Kotlin implementation with OpenGL ES is fast enough and good enough for the purposes which are needed).

I never used Visual Studio for Android development, I use it for years for desktop development - incl. game engines. Visual Studio tools for desktop are significantly superior to Android Studio ones for mobile, no doubt about that. Android Studio also feels a lot slower with gradle and everything around it.

But it is usable and good-enough tool for me.

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

HardlineStudios said:
I've heard good things about Android Studio native development.

I've made a game using NDK. That was 10 years ago, though. But it worked well.

Basically i've developed the game as a usual Win32 application using OpenGL and C++. STL was not supported by NDK, but i did not use it anyway.

For Android and iOS i have used Java / Objective C to handle OS stuff, audio, input, and to create threads. OpenGL code needed no changes, because it did respect the OpenGL ES limitations on Windows already.
This was very little device specific code. I did not learn about the Objective C language at all for example, but still could make it work by some trial and error.
It surely is possible to move more of those things to the C++ side now. Afaict this became better with time, eventually up to the point where you can do everything using C++ if needed.

AFAIK it's now possible to develop and build android C++ code in visual studio.
https://visualstudio.microsoft.com/vs/android/

Native game development in Android is pretty much supported lately. C++ support in Android Studio IDE is so much better than before. You use Gradle and CMake, instead of the old ndk-build stuff.

First of all if you want to go native coding hardcore on your own, you can create your own Activity and then create your C++ native library that runs as separate thread. Of course, you have to handle all the multi-threading stuff yourself. This is basically creating your own android native glue to the main thread (which is the “Java” app). This way you can even use C if you like. This is the hardcore way.

Second, a little easier option you can go for NativeActivity. You can code purely with C++, although NativeActivity itself is a Java code, just built-in so you don't need to see it. You can still use C with this mode, and get away from C++ standard library, cause shared library of it is kinda huge, almost 1 MB. With NativeActivity, you can go less than 500 KB for the release build. I think I got to 176 KB just to display a triangle. The only problem is, NativeActivity depends on the NDK cycle which is, if I recall, kinda 2 updates a year. Lastly if you want to deal with Java code, for example, login, ads, IAP, and other Google-related SDK, you have to deal with Java stuff, which is way hard to deal with in NativeActivity, more than just having a default Java/Kotlin activity in the first place. This is not recommended by Google and they expect you to migrate you to…

Third, is the latest Google's recommended way: using the AGDK (Android Game Development Kit) starting with embedding GameActivity and friends. This one kinda has C++ standard library embedded to it so you are forced to include it (and the license, that is). It has support for game input, keyboard input, and more. For the Audio you can use Oboe if you want to be consistent in Modern C++ style (it has a lot of its benefits too, considering Android device count is a massive horror). This one is basically like NativeActivity but easier. You'll be supported with, again I kinda forgot, bi-weekly updates on the SDKs, all that focus on game development. GameActivity is a Java activity that you can use to extend from default activity, so it is entirely possible to create the latest default Android template and then just embed these SDKs. It's pretty easy yet up-to-date, but still as native as you can have. The thing is this one enforces you to modern C++, so C++ standard library must included (or the GameActivity will throw an error… it has STL vector and string the last time I read it there). Add that with Kotlin and stuff, I think you get around 3.5 MB release base APK.

Outside of that if you don't talk about OpenGL ES, Vulkan is fully supported since Android 7+ which I personally still don't recommend due to how suck the vendors to have their device to keep up with it, and then Vulkan 1.1 after Android 10+. Google also seems to force devs in recent news (hopefully I didn't read it wrong) to create apps with min SDK at least 2 versions older than the latest, my only speculation is so that the device vendors would keep up with a more strict baseline. Also as far as I know Android made a jargon about “Vulkan everywhere” since Android 10 (or 11 I forgot), which refers to Vulkan 1.1. This should ensure that (hopefully, outside the flashed ones) all of Android 10+ devices are Vulkan 1.1 capable, and maybe that makes everyone feel safe to develop with it. To be fair Android is WAY behind Apple devices in terms of graphics. For example, Android barely reaches Vulkan 1.3 and don't even mention about mesh shader extension. But Apple Metal 3 already has ray tracing and mesh shader in it, though I believe the mesh shader still for the mac and iPadOS, if I'm not wrong.

If you still wish to extend to Visual Studio, I think they also provide it with something called AGDE (Android Game Development Extension). I never tried it but you may wanna check the link below (or you can just google these abbreviations).

For the AGDK (and AGDE), you can find more information from the link here: https://developer.android.com/games/develop/overview​​

Unrelated note: I kinda forgot my old account's password and my email itself too, so I have to create a new one just to answer this, lol.

There are couple of IDE programs running on Android, including gcc and precompiled popular libraries. I used one of those, but i discontinued deployment for Android, because i realized it didn't brings me a penny.

I tried Visual Studios native Android development but it seemed weak. Had issues even getting it to work. I then tried Android Game Development Extension kit and it's pretty solid! It integrates beautifully with Visual Studio, allows for easy management of SDK's and has exceptional debugging capabilities!

I had to fiddle with some Gradle settings but nothing Chat GPT can't help you sort out.

My vote goes with AGDE.
https://developer.android.com/games/agde

None

This topic is closed to new replies.

Advertisement