#How does one go about making a Android app in purely C++?

29 messages · Page 1 of 1 (latest)

upbeat valley
#

I have looked around on Google, but Visual Studio only showed Java (I couldn't get C++ to even show up) and Android Studio seems to use both Java and C++, but I only want C++. If anyone can suggest a solution, please do.

nimble hareBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

tawdry crown
#

you can not. every android application has atleast a bit of java or kotlin to initialize and load the c++ shared library

#

unless you use some kind of framework which abstracts all away (which there are not many) , you need to use java or kotlin

#

another approach is using some rendering library, as if you were making a game. but for an application that is not supposed to be a game it's just going to look weird

unkempt badger
#

yeah you can't avoid the Java

#

you need the NDK

#

there is this library that makes it a bit less painful

tawdry crown
#

uh i didnt know about this

unkempt badger
#

you can use C/C++ in Android apps

#

there is a bit of Java at initialization like you said

upbeat valley
#

i see. i was hoping to avoid Java, but I am capable of programming in it, so i will if i must

tawdry crown
#

you just need for the initialization really, and if you want to make some native gui too

tawdry crown
unkempt badger
#

altho there are other languages that abstract over this and don't require Java

#

web frameworks trolol

upbeat valley
#

i was trying to avoid those at all costs

#

they do not look fun

unkempt badger
tawdry crown
#

oh so as i said its just rendering

#

ah yea its says there

unkempt badger
#

I suppose this is good for turning really low end android devices into small computers like the raspberry pi

#

so yeah Kotlin is your best shot

#

(Java was my first language, I didn't enjoy it)

ashen lintel
#

It is actually completely possible, however it does come with some limitations.

Say you want to create an C++ executable for Android ARM64, you use Clang to cross compile your C++ program, with target set to Android AArch64. When you have your executable, push it to /data/local/tmp and then give the file the required permission so that you can execute it. Then just

adb shell
cd /data/local/tmp
./myExecutable
tawdry crown
#

that is what i did to update my code without recompiling the apk

#

or not like that but something similar

ashen lintel
#

It's a pretty common technique used when you want to test some new code/feature or call some android api function without having to deal with the android bloat. Then when we have our small C++ executable working, we create the proper android project