How feasible is it to port from an ObjC/C++/Swift iOS app to Android using Kotlin with C++?

Hello!
I like to know how feasible is having an Android app using Kotlin and C++
In the past I ported an iOS game made in ObjectiveC & C++ with OpenGL ES, to Android using Java and C++
Now I have a 3D graphics app in iOS using Swift/ObjC/C++ that I like to port to Android, Kotlin for the UI and C++ for GL and almost everything else.
Anyone been in that situation ?
I remember to have read that Kotlin only interfaces with C, and have to workaround to reach C++, I could go with Java but I see that Kotlin is preferred these days for Android
Thanks in advance

Yes, using Kotlin and C++ for your Android app port is definitely a feasible and exciting choice. Kotlin has a modern syntax which works well with Java and it can be used for Android development. On the other hand, C++ supports high performance and allows code reusability important especially in graphics-intensive applications.
From my own experience in similar projects, I have found that this combination results into efficient even high quality Android applications. But some how there might be a bit of a learning curve if you are new to Kotlin, the benefits often outweigh the challenges.
But don’t forget that the combination of Kotlin and C++ might require a bit of extra effort.

Thanks a lot for the reply @ameyaberan
I’m new to Kotlin but I find it similar to Swift, so I expect that is not going to be much trouble for me, I have this on Windows, macOS and iOS, so I guess it’s a matter of putting all the pieces together in Android, mostly the Kotlin & C++ interoperability is what I don’t know how to do it now, any resource you can recommend for that ?
Thanks again!

Hello,
Kotlin and C++ Integration:
Kotlin can interface with C++ through the Java Native Interface (JNI). This allows you to call C++ code from Kotlin, although it requires some setup.
You can use the Android Native Development Kit (NDK) to include your C++ code in the Android project. The NDK provides tools to compile C++ code and integrate it with your Android app.
Project Setup:
Create a new Android project in Android Studio with C++ support. This will set up the necessary directories and build configurations.
Place your C++ code in the cpp directory of your project module. Use CMake or ndk-build to compile the C++ code into a native library.
JNI Configuration:
Define the JNI methods in your C++ code and create corresponding native method declarations in your Kotlin code.
Use System.loadLibrary to load the native library in your Kotlin code and call the native methods as needed.
UI Development with Kotlin:
Kotlin is now the preferred language for Android development due to its modern features and interoperability with Java. You can use Kotlin to build the UI and handle user interactions.
Cross-Platform Considerations:
Since you have experience with Objective-C and C++ on iOS, you can leverage your existing C++ code for the graphics logic. This will minimize the amount of code you need to rewrite.
Ensure that your C++ code is platform-independent as much as possible to facilitate easier porting.
Resources and Tutorials:
The Android Developers guide provides detailed instructions on adding C++ code to your project and configuring JNI. FlyingTogether
There are also community forums and tutorials that discuss similar porting scenarios, which can provide additional insights and tips.
Best Regards
franktucker907

Thanks a lot for the info @franktucker907
This is of great help!

Sorry for the late reply! It’s great to hear that you find Kotlin similar to Swift; that should definitely help with your learning curve! For Kotlin and C++ interoperability, I recommend checking out the official Kotlin documentation, which has a section dedicated to using C++ with Kotlin. Additionally, you might find the book Kotlin Programming: The Big Nerd Ranch Guide helpful, as it covers practical examples and interoperability.

You can also look at online resources like the Kotlin YouTube channel for tutorials on this topic or visit platforms like GitHub, where you might find sample projects demonstrating Kotlin and C++ integration. Don’t hesitate to reach out if you have specific questions as you dive in!