lzhiyong / termux-ndk

android-ndk for termux
Other
485 stars 52 forks source link

Add to Termux User Repo (TUR)? And be a building block for Android Studio in Termux. #156

Open knyipab opened 2 months ago

knyipab commented 2 months ago

As now Termux has TUR for package by user, would you by any chance want to add it to TUR? Indeed, Android Studio could run and build Android SDK app on Termux (with OpenJDK and more) without much modification. However, building NDK app will require your Android NDK build. Having your repo added to and maintained in TUR sounds to be a great idea. It would be cool to see Android app development in an Android device.

robertkirkman commented 2 months ago

Edit: I am very stupid and everything I said in this message is wrong, ignore this now

to give you a quick up to speed so you can gain understanding:

Android Studio's GUI contains closed-source proprietary code in the jetbrains intellij family that consists, as you would quite typically and naturally expect from closed-source, of released binaries which were built and linked against the GNU C library found by default ONLY in the GNU/Linux operating system, and not the Bionic C library that is necessary for pure Android development. For this reason, should one wish to run the real "Android Studio", the only two ways that is remotely possible are 1. by using a proot/chroot containing a rootfs fully built and linked against the GNU C library or 2. a massive and astronomically huge amount of work to completely decompile and reverse engineer the closed source glibc-linked binaries found within Android Studio back into a fully decompiled source tree to a sufficient degree to enable it to be patched and recompiled targeting the Bionic C library and other native Android OS libraries and filesystem paths (in my opinion that option 2. is a purely hypothetical fantasy that is not typically considered possible for apps the size of Android Studio).

So I think mentions of "Android Studio" are not likely to be in-scope or relevant to this repo, BUT I agree with what you said about TUR and that is relevant. I would love to see lzhiyong/termux-ndk in TUR.

knyipab commented 2 months ago

I managed to run Android Studio on Termux (without proot), build and run app with adb. I will provide my steps (with workarounds) below and, in short, it is believed that

Steps to run Android Studio in Termux

knyipab commented 2 months ago

Therefore, a big missing part of this approach to Android Studio on Termux is the availability of NDK. And this repo can indeed fill the gap. I think once this repo is cleaned and become avilable on TUR. I will make a package called android-studio on TUR applying all workarounds above.

It is quite exciting for me to see the use case of app development with Android Studio on an Android phone in Desktop mode (e.g. DeX mode), connected to a monitor screen and keyboard.

robertkirkman commented 2 months ago

Wow, you are absolutely right and I am completely wrong!!! I am really sorry for being so stupid. I tried to find the source code of Android Studio once and do what you did, and when I couldn't get it to work and I couldn't find the source code, I simply assumed it was closed source and never tried to do it again. But Actually everything you said is right, your way actually works it's amazing! and android studio and intellij actually are both open source and I never knew that until you told me.

https://android.googlesource.com/platform/tools/idea/

https://github.com/JetBrains/intellij-community

robertkirkman commented 2 months ago

Android Studio, IntelliJ community and termux-ndk should all be in TUR

lzhiyong commented 2 months ago

This repository is not suitable for Termux TUR, mainly because there is no universal build script and patches. due to the NDK version updates, I need to make some changes every time I compile.

knyipab commented 2 months ago

Thank you for the reply.

By "version updates", do you mean NDK version updates, (Termux) build tool version updates or host Android updates? Unlike the main repo, TUR indeed welcomes software package in specific version e.g. python3.8, python3.9, meaning that you could keep your approach to have patches specific to a targeted NDK version. This is also what I anticipate your project to be listed on TUR, just like NDK of different versions can be used in Android Studio (ideally the ndk TUR package will install in the default path $HOME/Android/Sdk).

The build tool version can also be easily locked with the use of containers and versioned TUR packages. TUR is quite versatile in the choice of build environment, including Ubuntu container and Termux container (emulating on-device build).

I think my point of making it on TUR is not about auto rebuild at all, but more about 1) making the binaries accessible to users and 2) serving as dependencies and a building block for other app, especially Android Studio.

I wish I did not ask for too much. Essentially what I am requesting is migrating the build process into the TUR fashion (while remains to be version-specific as it is).

@robertkirkman no worries and I'm glad to draw your attention to my post and know that someone else are interested.