Yes, Android apps can and do have native libraries. Sometimes this can be part of a SDK, or otherwise out of the developers control.
Re:Adding 16 KB Page Size to Android
by warkdarrior on Friday August 23, 2024 @04:11PM
(#41332669)
Apps written in Flutter/Dart and React Native/Javascript both compile to native code with only shims to interface with the Java UI framework.
Flutter/Dart, yes, React Native/Javascript, no. With RN the app's code runs via an embedded JavaScript engine, and even when, say, Hermes is being used, it's still executing bytecode not native machine code.
Also important to note that any code that runs on Android's ART runtime (i.e. Kotlin and/or Java) can get some or all of its code AOT-compiled to machine code by the OS, either upon app install (if the app ships with baseline profiles) or in the background while the device is idle and charging.
Android apps can call into native code via JNI, which the platform supports.
Re:Adding 16 KB Page Size to Android
by ignoramous on Friday August 23, 2024 @06:37PM
(#41333685)
Wonder if Android apps can also be fully native (C++)?
It is possible to have a project set up with a manifest which contains only a single activity with android.app.NativeActivity pointing to a .so, and zero lines of java/kotlin/flutter/whatever else - though your app initialization will go through usual hoops of spawning a java-based instance.
Minimal example would be https://github.com/android/ndk-samples/blob/master/native-ac..., though there are well established Qt based apps as well
Re:Adding 16 KB Page Size to Android
by extraduder_ire on Saturday August 24, 2024 @11:59AM
(#41339129)
I saw a project posted on here a while back about writing android apps with no java, only c.
There is no good reason to do it, but it is apparently possible.
Re:Adding 16 KB Page Size to Android
by david_allison on Friday August 23, 2024 @04:51PM
(#41332990)
The Android Native Development Kit (NDK) allows building native code libraries for Android (typically C/C++, but this can include Rust). These can then be loaded and accessed by JNI on the Java/Kotlin side
* Brief overview of the NDK: https://developer.android.com/ndk/guides
* Guide to supporting 16KB page sizes with the NDK https://developer.android.com/guide/practices/page-sizes
Re:Adding 16 KB Page Size to Android
by dotancohen on Saturday August 24, 2024 @11:05AM
(#41338819)
Good to know, thank you!
Chrome browser on Android uses the same code base as Chrome on desktop including multi-process architecture. But itβs UI is in Java communicating with C++ using JNI.
Re:Adding 16 KB Page Size to Android
by dotancohen on Saturday August 24, 2024 @11:06AM
(#41338824)
I had no idea, thank you!
Or do some Android applications run embedded C with only a Java UI? I'm not an Android dev.