Android programming is possible (there's a catch)
Posted: Tue Nov 24, 2020 9:32 pm
Many threads and blog entries have given people a false impression that you might be able to use the Raspberry pi to write Android code and build APKs.
This is not the case in the usual sense, because although you can install various broken parts of the Android SDK from the Debian project, you cannot install Android Studio which is critical for active development especially because nowadays it contains the SDK manager, which is needed to auto-download various up-to-date required tools like gradle. Without the latter, you won't have sufficient certificate checking to build code via the command line.
That said, there is one totally different way to use Android Studio on the Raspberry pi. You're not going to like it. It is very slow. It requires the following steps:
0. Obtain the Raspberry pi 4, 8GB model and put a fan on it.
1. Install 64-bit Raspberry pi OS on a MicroSD of about 64GB and boot that.
2. Install the latest Qemu. To ensure best performance, build it yourself with all compiler optimizations.
3. Create a 32GB blank hard drive .img file with qemu-img.
4. Run Qemu for x86_64, giving it 2 or 3 cores and at least 4GB of RAM, and install your favorite Intel distro from an ISO file. (Whichever version is newest.)
5. Boot it up, and use Firefox within the x86_64 emulation to download Android Studio for Linux from Google and install it in /usr/lib.
6. Run studio.sh and let it update itself (it will take a few hours).
What this will provide you is a very slow emulation of an Intel Linux computer, running perhaps 1/100th of normal speed.
The x86_64 emulation by aarch64 appears to be not very efficient and it doesn't help that the Pi has small CPU caches.
In my opinion, this approach to running Android Studio is only useful for compiling existing apps into APK files, not for active development unless you are an extremely patient person.
It will take hours to build any sophisticated app, but this may be preferable to buying an Intel-based computer depending on your situation.
This is not the case in the usual sense, because although you can install various broken parts of the Android SDK from the Debian project, you cannot install Android Studio which is critical for active development especially because nowadays it contains the SDK manager, which is needed to auto-download various up-to-date required tools like gradle. Without the latter, you won't have sufficient certificate checking to build code via the command line.
That said, there is one totally different way to use Android Studio on the Raspberry pi. You're not going to like it. It is very slow. It requires the following steps:
0. Obtain the Raspberry pi 4, 8GB model and put a fan on it.
1. Install 64-bit Raspberry pi OS on a MicroSD of about 64GB and boot that.
2. Install the latest Qemu. To ensure best performance, build it yourself with all compiler optimizations.
3. Create a 32GB blank hard drive .img file with qemu-img.
4. Run Qemu for x86_64, giving it 2 or 3 cores and at least 4GB of RAM, and install your favorite Intel distro from an ISO file. (Whichever version is newest.)
5. Boot it up, and use Firefox within the x86_64 emulation to download Android Studio for Linux from Google and install it in /usr/lib.
6. Run studio.sh and let it update itself (it will take a few hours).
What this will provide you is a very slow emulation of an Intel Linux computer, running perhaps 1/100th of normal speed.
The x86_64 emulation by aarch64 appears to be not very efficient and it doesn't help that the Pi has small CPU caches.
In my opinion, this approach to running Android Studio is only useful for compiling existing apps into APK files, not for active development unless you are an extremely patient person.
It will take hours to build any sophisticated app, but this may be preferable to buying an Intel-based computer depending on your situation.