4 ms·
> Clangd support for C++ That’s interesting, how common is it to write C++ for Android applications, and with Android Studio? I’m not that informed regarding a
by dgellow 6y ago
> Clangd support for C++
That’s interesting, how common is it to write C++ for Android applications, and with Android Studio? I’m not that informed regarding android stuff but I understood that the native development kit wasn’t really that well maintained, making C++ an 2nd class citizen when compared to Java (and maybe Kotlin?).
I would guess it’s mostly used for games?
- tarkin2 6y agoOpenCV, for example, uses C++ bindings. C/C++ binding are a nightmare in Android Development. This probably improves the situation.
- tick_tock_tick 6y agoC/C++ is only the only choice for cross platform business logic between windows/ios/android/macos.
- nicoburns 6y agoYou can also use Rust (and some big companies are - Cloudflare is shipping Rust on Android/iOS for their warp VPN, and Dropbox uses it in their desktop sync client (not sure if the same code is also used on mobile)).
- javajosh 6y agoVery interesting. Do you have any sources for people targeting Android with Rust?
- nicoburns 6y ago- https://github.com/cloudflare/boringtun https://github.com/cloudflare/boringtun - https://blog.cloudflare.com/warp-technical-challenges/ https://blog.cloudflare.com/warp-technical-challenges/ - https://www.reddit.com/r/rust/comments/8ygbvy/state_of_rust_for_iosandroid_on_2018/ https://www.reddit.com/r/rust/comments/8ygbvy/state_of_rust_... - https://medium.com/visly/rust-on-android-19f34a2fb43 https://medium.com/visly/rust-on-android-19f34a2fb43 - https://medium.com/visly/rust-on-ios-39f799b3c1dd https://medium.com/visly/rust-on-ios-39f799b3c1dd
- scns 6y agohttps://dev.to/robertohuertasm/rust-once-and-share-it-with-android-ios-and-flutter-286o https://dev.to/robertohuertasm/rust-once-and-share-it-with-a...
- benibela 6y agoI use Pascal for that
- gardaani 6y agoWhat about writing Kotlin and running Kotlin/Native on iOS, Windows and Mac? Is anyone doing that? https://kotlinlang.org/docs/reference/native-overview.html https://kotlinlang.org/docs/reference/native-overview.html
- Uhhrrr 6y agoI am doing it right now, for a computer vision app. CMake is kind of a pain, but the rest of it works fine. My one other work-related Android app also used C++, for computer vision-related stuff, 8 years ago. Android Studio/Kotlin/C++ is in my very subjective opinion about 20% better than 2012 Eclipse/Java/C++. If I wanted to do basically everything in C++, I would strongly consider Qt.
- pjmlp 6y agoMaybe with the latest Qt release it has gotten better, as they have improved the JNI bindings support. When I tried it about 5 years ago, I ended up dropping Qt and doing Java/C++, because the effort to call Java from Qt wasn't worthwhile.
- Uhhrrr 6y agoI can't speak to that. Certainly for an app which spends a significant amount of time in UI-land it's better to stay on the anointed path if possible.
- Hokusai 6y agoGames used to be coded in C++, in Visual Studio or other IDE, as can be ported to all platforms and Java was used for a thin Android specific layer. If your game breaks in Android then you need to use Android Studio for debugging. It works perfectly well. But, nowadays has been superseded by the prevalence of Unity 3D.
- kllrnohj 6y agoC++ for the UI is extremely uncommon, and very second-class citizen. C++ for parts of an app, though, is common enough. For example Facebook's Litho is a Java API, and uses a large chunk of the Android SDK's systems. But it also uses a layout engine in C++. This hybrid approach isn't uncommon, and Android Studio has some nice features to work in this mode like being able to follow usages across the JNI boundary and to auto-generate the JNI stubs.
- nurettin 6y agoI used it to create a bridge between a C library for audio encoding and my android application. So I assume people use it to create JNI wrappers around third party native libraries.
- pjmlp 6y agoFrom Google's point of view, C and C++ should only be used for writing native methods, not full blown applications. Naturally via this mechanism you can also write portable business code that is exposed via Java bindings library. Or you invert the logic, and the application is written as a library, with Java/Kotlin just doing the OS connection points and having the NDK logic somehow driving application. Vulkan and real time audio are also only available via the NDK, to use them from Java/Kotlin you need to write your own bindings.