AndroidIDE icon indicating copy to clipboard operation
AndroidIDE copied to clipboard

[FEATURE]: NDK support (for arm and aarch64)

Open s3gf4ultt opened this issue 3 years ago • 4 comments

I got a working NDK on termux with arm support (2016 version), there's a version for aarch64 too but I haven't tested.

ndk for arm devices ndk for aarch64 devices

For this to work on android some environment variables must be set first, setup for arm NDK:

PATH=$PATH:~/android-ndk export NDK_KNOWN_ABIS="armeabi-v7a armeabi-v7a-hard armeabi x86" export NDK_KNOWN_ARCHS="arm x86" export HOST_ARCH="arm" #For android 5+ you need to set "true" export APP_PIE_REQUIRED=false

After that, we must create a chroot under /data/data/com.your.androidide/rootfs (otherwise some binaries, like arm-linux-androideabi-ld will lead to a bad system call), this chroot directory must have all essential directories into it (like /bin , /usr, /tmp etc) this is important because some NDK binaries try to run other binaries on /bin for example (or try to make tmp files under /tmp) without chroot these binaries will access the Android itself file system instead of your Linux file system.

There are two ways of making a chroot on Android (with root and without root). The simplest and fastest way is using the chroot command wich requires root, or you can try the without root method using the PRoot

s3gf4ultt avatar Apr 15 '22 14:04 s3gf4ultt

NDK will be available in future versions of AndroidIDE.

Till then, you could always use termux-ndk.

itsaky avatar Apr 21 '22 01:04 itsaky

Do you mean I should "manually" use this? Does it work

Does aide attempt to stop gradle for downloading the ndk?

I've had the experience in Linux that I eventually had ten ndk directories ten gig each. Apparently gradle and/or apps try to download a certain ndk that's specified in gradle files

EVEN IN DEBIAN ARM THIS IS STILL A DISASTER. \0/ Google what are you doing

john-peterson avatar Jun 25 '23 14:06 john-peterson

@MrIkso has provided instructions on how to install and use NDK in AndroidIDE. The instructions are available here.

Do you mean I should "manually" use this? Does it work.

It works.

Does aide attempt to stop gradle for downloading the ndk?

No. I don't know if that is even possible.

itsaky avatar Jun 25 '23 14:06 itsaky

Maybe this should work as aapt2fromMavenOverride. For example call this NdkFromGradleOverride, as the downloaded ndk from developers.android.com or where Gradle downloads it from, doesn't contain folder linux-aarch64 or linux-armeabi for needed ARM arch, only linux-x86_64 in the llvm toolchains.

Alex3474247 avatar Oct 03 '23 14:10 Alex3474247