Pure NDK app without using java/kotlin at all.

329 views
Skip to first unread message

Denis

unread,
Mar 11, 2023, 10:43:46 AM3/11/23
to android-ndk
At first sorry for my English. If u don't understand me, ask me and I will try to say/put it another way.

The question is the next.

Can I make any app using only NDK(C++)?

I mean, can I make any app without using Java/Kotlin like it would been written on Java/Kotlin(using all android Java components)?

I know if it's possible I'll have to write a lot of code, but I'm ready to dive into the NDK completely, but I don't want to spend my time learning and after that I find out that I won't be able to use some features without java/kotlin those could be used only in java/kotlin.

For example.
Can I extend java's classes in C++ language and use them in C++?
Can I override/implement any method of any class/interface in C++ and use them in C++?
Can I do all the stuff in C++ like it could be used in java/kotlin?

Maybe I forgot something about, so you can add yours suggestions/remarks or whatever, you want to say.

And I don't ask you to refer me some links to some documentation if it's not worth it.

I just want to know the next.
"Yes, you can to do all the stuff you want without java/kotlin"
"No, you can't to do all the stuff you want without java/kotlin"

P.S.
If you are proffi in that, I want to be your friend and you will help me with those questions I can ask you 😄(I know, people cannot to know everything, so we will figure out that toggether 🙃).

P.P.S. I need some the smart friend(If you are smart, you will understand that).

enh

unread,
Mar 11, 2023, 10:47:19 AM3/11/23
to andro...@googlegroups.com
On Sat, Mar 11, 2023 at 7:43 AM Denis <myi...@gmail.com> wrote:
At first sorry for my English. If u don't understand me, ask me and I will try to say/put it another way.

The question is the next.

Can I make any app using only NDK(C++)?

no.
 
I mean, can I make any app without using Java/Kotlin like it would been written on Java/Kotlin(using all android Java components)?

no.
 
I know if it's possible I'll have to write a lot of code, but I'm ready to dive into the NDK completely, but I don't want to spend my time learning and after that I find out that I won't be able to use some features without java/kotlin those could be used only in java/kotlin.

For example.
Can I extend java's classes in C++ language and use them in C++?
Can I override/implement any method of any class/interface in C++ and use them in C++?
Can I do all the stuff in C++ like it could be used in java/kotlin?

Maybe I forgot something about, so you can add yours suggestions/remarks or whatever, you want to say.

And I don't ask you to refer me some links to some documentation if it's not worth it.

I just want to know the next.
"Yes, you can to do all the stuff you want without java/kotlin"
"No, you can't to do all the stuff you want without java/kotlin"

no, you can't do all the stuff you want without java/kotlin.

(and why would you even want to? C/C++ is harder and more error-prone. if you have parts of your app that should be in C/C++ because you _can't_ write them in Java/Kotlin, or because the same code needs to run on other operating systems where you can't use Java/Kotlin, then write those _parts_ in C/C++ but leave the rest in Java/Kotlin.)
 
P.S.
If you are proffi in that, I want to be your friend and you will help me with those questions I can ask you 😄(I know, people cannot to know everything, so we will figure out that toggether 🙃).

P.P.S. I need some the smart friend(If you are smart, you will understand that).

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/93401e96-14bc-481f-a445-8ffd56785530n%40googlegroups.com.

Matej Magat

unread,
Mar 13, 2023, 11:54:11 AM3/13/23
to android-ndk
there is one (what I know) option how to build ndk only apk, is limited and use opengl, but is there,
the result apk is 25-45KB small!
If you need java interface you could use jni...

Dátum: sobota 11. marca 2023, čas: 16:47:19 UTC+1, odosielateľ: enh

Denis

unread,
Mar 13, 2023, 11:54:11 AM3/13/23
to android-ndk
Hi enh, Big thanks for your response.

суббота, 11 марта 2023 г. в 17:47:19 UTC+2, enh:
(and why would you even want to? C/C++ is harder and more error-prone. if you have parts of your app that should be in C/C++ because you _can't_ write them in Java/Kotlin, or because the same code needs to run on other operating systems where you can't use Java/Kotlin, then write those _parts_ in C/C++ but leave the rest in Java/Kotlin.)

I think it is related to security and slow java.

I don't really like java, and don't wanna to use it(I can nothing to say about kotlin, i didn't use it at all), additionally to that, java easily can be decompiled even if compiled with proguard, despite that proguard just change names of variables/methods/classes to make it difficult for understanding what it does(that's all I know, I didn't use proguar to be sure I'm saying), but anyway java's code even with proguard doesn't hide all the algorithms/usage.

Maybe I'm too worried about it, and I have to step over my principles.

Sorry if it is not related to this group.

Matej Magat

unread,
Mar 13, 2023, 11:54:11 AM3/13/23
to android-ndk
Sory if I make duplicate ...
You can try:
is primitive, but complete without java and as bonus small 25-45KB!
if you need, you will be able call java funkcion thank JNI. 
Dátum: sobota 11. marca 2023, čas: 16:47:19 UTC+1, odosielateľ: enh
On Sat, Mar 11, 2023 at 7:43 AM Denis <myi...@gmail.com> wrote:

enh

unread,
Mar 13, 2023, 11:57:04 AM3/13/23
to andro...@googlegroups.com
On Mon, Mar 13, 2023 at 8:54 AM Denis <myi...@gmail.com> wrote:
Hi enh, Big thanks for your response.

суббота, 11 марта 2023 г. в 17:47:19 UTC+2, enh:
(and why would you even want to? C/C++ is harder and more error-prone. if you have parts of your app that should be in C/C++ because you _can't_ write them in Java/Kotlin, or because the same code needs to run on other operating systems where you can't use Java/Kotlin, then write those _parts_ in C/C++ but leave the rest in Java/Kotlin.)

I think it is related to security and slow java.

security is one of the main reasons to use java. and, like i said, not _all_ of your app will be a hotspot; there's a reason many game _engines_ are in C/C++ but the _games_ are in a safer managed language.
 
I don't really like java, and don't wanna to use it(I can nothing to say about kotlin, i didn't use it at all), additionally to that, java easily can be decompiled even if compiled with proguard, despite that proguard just change names of variables/methods/classes to make it difficult for understanding what it does(that's all I know, I didn't use proguar to be sure I'm saying), but anyway java's code even with proguard doesn't hide all the algorithms/usage.

there are equivalents for C/C++.
 
Maybe I'm too worried about it, and I have to step over my principles.

Sorry if it is not related to this group.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.

enh

unread,
Mar 13, 2023, 11:58:28 AM3/13/23
to andro...@googlegroups.com
On Mon, Mar 13, 2023 at 8:54 AM Matej Magat <matej...@gmail.com> wrote:
there is one (what I know) option how to build ndk only apk, is limited and use opengl, but is there,
the result apk is 25-45KB small!
If you need java interface you could use jni...

which is why "ndk only" and "without java" is never really true --- you're always running in the context of a Java runtime anyway. or, if you like: "you've paid for it, so you may as well use it".
 

Denis

unread,
Mar 17, 2023, 12:33:56 PM3/17/23
to android-ndk
Thanks to you all for your responds, i will try any possible suggestion those was and will be suggested here.👍

Akram Raza (‫أكرم رضا‬‎)

unread,
Mar 17, 2023, 2:11:39 PM3/17/23
to android-ndk
Maybe I am joining the discussion late , but in 2021 Google had a program for developers where mentors selected by Google provided classes to leaners. And there I raised the same question "App Security". And the response was that if proguard fails to fulfill your requirements you should go for paid programs which basically encrypt your classes.dex file. 
And for your question of security if you think making an app using purely ndk is safe then you are in deep darkness. Nothing is safe and most importantly ndk based modules are the worst in case of security. In case of java/kotlin atleast there are few steps involved for decompiling but for ndk based modules it only takes 1 step which is extracting out the file from the app. After that you just need to load it in any decompiler such as ida for static or ghidra for dynamic and literally all your c/c++ code is decompiled and exposed within few seconds.
There are multiple ways of hiding your sensitive data in case of java/kotlin , you should look into those. Also there are multiple ways for hiding your methods and classes also for example use ART method(introduced with android oreo) which basically package your app in odex and vdex file and generates classes.dex during runtime. Or you can use stub encryption.
So if your concern is app getting reversed I don't think making your app purely native is going to solve it. Yes, going native helps in performance only if that block of the app fits perfectly in native code otherwise you are exposing your code on your own. In case of java/kotlin you can use multiple ways to achieve better performance like asynchronous programming or prepare everything before it's needed by making use of the lifecycle events for example by cacheing data before your app is destroyed so next time you already have the data for the user , instead of making the user wait for it.

Denis

unread,
Mar 20, 2023, 11:25:46 AM3/20/23
to android-ndk
Hi Akram Raza. Not late. You're always welcome.

пятница, 17 марта 2023 г. в 20:11:39 UTC+2, Akram Raza (‫أكرم رضا‬‎):
Maybe I am joining the discussion late , but in 2021 Google had a program for developers where mentors selected by Google provided classes to leaners. And there I raised the same question "App Security". And the response was that if proguard fails to fulfill your requirements you should go for paid programs which basically encrypt your classes.dex file. 
And for your question of security if you think making an app using purely ndk is safe then you are in deep darkness. Nothing is safe and most importantly ndk based modules are the worst in case of security. In case of java/kotlin atleast there are few steps involved for decompiling but for ndk based modules it only takes 1 step which is extracting out the file from the app. After that you just need to load it in any decompiler such as ida for static or ghidra for dynamic and literally all your c/c++ code is decompiled and exposed within few seconds.
There are multiple ways of hiding your sensitive data in case of java/kotlin , you should look into those. Also there are multiple ways for hiding your methods and classes also for example use ART method(introduced with android oreo) which basically package your app in odex and vdex file and generates classes.dex during runtime. Or you can use stub encryption.

I'm not arguing that cpp/c can't be de-compiled, but it's even harder to understand, if it de-compiled to assembler, but not to java(or i'm wrong).
 
So if your concern is app getting reversed I don't think making your app purely native is going to solve it. Yes, going native helps in performance only if that block of the app fits perfectly in native code otherwise you are exposing your code on your own. In case of java/kotlin you can use multiple ways to achieve better performance like asynchronous programming or prepare everything before it's needed by making use of the lifecycle events for example by cacheing data before your app is destroyed so next time you already have the data for the user , instead of making the user wait for it.

Thanks for your suggestion, I'll make more attention on it.
Reply all
Reply to author
Forward
0 new messages