News for hackers. Stuff that matters.
Re:Adding 16 KB Page Size to Android by dotancohen on Friday August 23, 2024 @02:46PM (#41331821)
Yes, but the context here is Java or Kotlin running on Android, not embedded C.

Or do some Android applications run embedded C with only a Java UI? I'm not an Android dev.

Re:Adding 16 KB Page Size to Android by orf on Friday August 23, 2024 @02:50PM (#41331875)
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.
Re:Adding 16 KB Page Size to Android by farmerbb on Friday August 23, 2024 @11:45PM (#41335417)
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.

Re:Adding 16 KB Page Size to Android by saagarjha on Friday August 23, 2024 @02:50PM (#41331872)
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++)?
Re:Adding 16 KB Page Size to Android by fensgrim on Friday August 23, 2024 @07:34PM (#41334052)
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.

https://github.com/cnlohr/rawdrawandroid

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!
Re:Adding 16 KB Page Size to Android by fpoling on Friday August 23, 2024 @05:03PM (#41333081)
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!