- Is Android really just Linux? (Video)
- What is Linux?
- Why Android is Linux
- Why Android isn’t Linux
- It doesn’t use the standard Linux kernel
- It doesn’t include the GNU software and libraries
- You cannot run Linux apps on Android – and vice versa
- Android is a Google product
- Android’s ‘open source’ status is up for debate
- You cannot customize the Android OS – by default
- Wrapping up
- Android
- Contents
- Transferring files
- App development
- Android Studio
- SDK packages
- Android Emulator
- Other SDK packages in the AUR
- Making /opt/android-sdk group-writeable
- Other IDEs
- Netbeans
- Vim / Neovim
- Emacs
- Other Tools
- Marvin
- Building
- Required packages
- Java Development Kit
- Setting up the build environment
- Downloading the source code
- Building the code
- Testing the build
- Creating a flashable Image
- Flashing
- Fastboot
- Samsung devices
- samloader
- Heimdall
- Odin (Virtualbox)
- Use Android on GNU/Linux
- Troubleshooting
- Android Studio: Android Virtual Devices show ‘failed to load’.
- Android Studio: ‘failed to create the SD card’
- Eclipse: During Debugging «Source not found»
- ValueError: unsupported pickle protocol
- libGL error: failed to load driver: swrast OR AVD does not load and no error message displayed
- sh: glxinfo: command not found
- Android Emulator: no keyboard input in xfwm4
- Android Emulator: Window is shaking and blinking when used in WM tiled mode
- Android Emulator: Segmentation fault (core dumped)
- adb: sideload connection failed: insufficient permissions for device
Is Android really just Linux? (Video)
Is Android Linux? is one of those frustrating questions that seems like it should have a straightforward ‘yes’ or ‘no’ answer, but these are three words that the Android and Linux communities have been debating for years.
There are two factors that have made it particularly difficult to reach a definitive answer in this long-running debate:
- People regularly use the word “Linux” to refer to a number of related, but distinctly different things.
- There’s no universally accepted definition about what makes a piece of software Linux.
In this article, I’m going to clear up the confusion surrounding the different kinds of software someone may have in mind when they use the term ‘Linux,’ before working through all the arguments that inevitably creep in, in every “is Android Linux” debate.
What is Linux?
When someone says the word “Linux,” they may be referring to:
- The Linux kernel. This is a small, but essential part of an operating system. The kernel is responsible for interfacing with a device’s hardware, providing services to the rest of the system, and performing tasks such as managing the device’s CPU and memory. The Linux kernel, like any kernel, can only function as part of a wider operating system. It’s impossible to have an operating system that consists solely of a Linux kernel. Since Android is a complete operating system, we can immediately rule out classifying Android as a Linux kernel.
- A Linux distribution, or distro. This is an operating system that contains the Linux kernel and additional software such as utilities, libraries and a GUI, plus pre-installed applications such as web browsers, text editors, and music players. Even if this additional software was designed specifically to run on the Linux kernel, it’s not part of the Linux kernel. When discussing operating systems that use the Linux kernel, the terms ‘distribution,’ ‘distro’ and ‘operating system’ are interchangeable. Since anyone can take the Linux kernel, add their own software, and create a complete operating system, there are countless Linux distros currently available.
- GNU/Linux. The majority of Linux distributions are a combination of the Linux kernel plus GNU software, which has led some people to argue that we should all be referring to Linux distros as GNU/Linux. This is a whole other debate, so to help keep things simple I’ll be using the terms ‘Linux distribution’ and ‘distro’ throughout this article – just note that there’s a strong link between the Linux kernel and GNU software.
While there’s nowhere near as much confusion surrounding the term “Android,” there are still two distinct strains of the Android operating system.
The first is the Android Open Source Project (AOSP), which is the project where Google release the Android source code. While it is possible to use this source code to build a functioning operating system that you can install on a smartphone or tablet, the end result would be lacking functionality that most users expect from their Android experience, most notably Google Mobile Services (GMS). GMS is the collection of Google apps and APIs that, for many users, are a fundamental part of the Android experience, in the same way that iTunes and the App Store are a fundamental part of the macOS experience. AOSP is open source, but the experience that your typical end-user expects from Android, isn’t provided by AOSP.
The Android operating system that ships on your typical Android smartphone or tablet is essentially an AOSP base, potentially with some manufacturer modifications, and with the addition of a significant amount of proprietary code.
Most of the arguments for and against classifying Android as Linux apply to both interpretations of Android, but there are a few instances where the answer differs, depending on whether you define Android as AOSP, or as the operating system that ships on your typical Android smartphone or tablet.
Why Android is Linux
There’s really only one argument in favor of classifying Android as Linux, but it’s a strong one: every Android smartphone or tablet contains a Linux kernel. You can even see what version of the kernel is installed on your device, by opening its ‘Settings’ app and navigating to ‘About Device > Software info.’
However, Android isn’t just the Linux kernel; it’s a fully-functioning operating system that features lots of additional libraries, a GUI, apps and much more, so when we ask “is Android Linux,” we’re actually asking “is Android a Linux distro?”
Since it’s impossible to even estimate how many Linux distros are out there, it’s very difficult to put together a list of rules about what makes an operating system a Linux distro.
Beyond the presence of the Linux kernel, the definition of a Linux distro is pretty open to interpretation, so in the rest of this article I’ll be discussing the arguments people most commonly put forward, when arguing against classifying Android as a Linux distribution.
Why Android isn’t Linux
It doesn’t use the standard Linux kernel
In order to create an operating system that meets the unique needs of mobile devices, the Android team made a number of changes to the Linux kernel, including the addition of specialized libraries, APIs and tools that are mostly BSD-derived or written from scratch, specifically for Android.
Since the entire argument in favor of classifying Android as a Linux distro hinges on the fact that Android uses the Linux kernel, this point might seem like it’s the end of the argument, but it’s not that unusual for a Linux distro to make changes to the kernel.
The Linux kernel is released under the GNU General Public License, so anyone is free to modify its source code, which many Linux distros have done. When it comes to the question of just how drastically the Android team modified the Linux kernel, the Embedded Linux wiki concludes that the amount of changes implemented by the Android team “is not extremely large, and is on the order of changes that are customarily made to the Linux kernel by embedded developers.”
It doesn’t include the GNU software and libraries
If you agree that GNU software is a defining characteristic of a Linux distro, to the point where we should all be referring to Linux distros as GNU/Linux, then there’s no way that Android can be a Linux distro. Android includes very little GNU software, most notably, the Android team developed a customized C library called Bionic, rather than use the GNU C Library.
Even if you disagree that a Linux distro has to include GNU software, then there’s still no denying that the absence of GNU makes Android very different from the majority of the Linux distro community.
You cannot run Linux apps on Android – and vice versa
If you picked several different Linux distros at random, then chances are that the Linux kernel would be the only software component they have in common. In fact, Android has such little software in common with other Linux distros, that it’s impossible to run regular Linux apps on Android.
The reverse is also true: Android apps require Android-specific libraries, a runtime, plus a range of other software that’s found only in the Android OS, so by default you cannot run Android apps on any platform other than Android.
Android is a Google product
Google may make the base Android source code publicly available via AOSP, but Google develops the next release of AOSP in private. In fact, the AOSP website clearly states that “Google retains responsibility for the strategic direction of Android as a platform and a product.”
In addition, although non-Google employees can contribute to AOSP in various capacities, the AOSP website makes it very clear that project leads are usually Google employees. There’s also the small matter of Google owning the rights to the Android name and logo, so even if you do build an operating system based on AOSP code, you’ll still need to liaise with Google if you want to release your work under the Android name.
While some Linux distributions do have strong links to a particular company (Canonical and Ubuntu immediately spring to mind) it’s unusual for a Linux distro to be developed in private, entirely by a single organization.
Android’s ‘open source’ status is up for debate
Despite the Free Software Foundation’s recommendation that developers remove all proprietary software from their Linux distributions, there’s no strict rule that states Linux distributions cannot include proprietary software. In reality many distros include vendor-compiled binary drivers, also known as binary blobs, so really the question is: how open is Android, compared to your ‘typical’ Linux distro?
While many open source enthusiasts would agree that AOSP is far from an ideal open source project, its code is freely available for other people to modify and distribute.
However, by the time the AOSP base reaches the Android user, a lot of proprietary code has been added, and this is true regardless of whether you opt for a “pure Android” device such as a Nexus or Pixel, or a device that features manufacturer modifications.
While this doesn’t necessarily disqualify Android from being labelled as a Linux distribution, it’s worth noting that much of the code that users can see and interact with is proprietary, such as Google Mobile Services and manufacturer-specific modifications like Samsung’s TouchWiz skin.
Although many Linux distros do include proprietary code, for many people the term ‘Linux’ has a strong association with open source software, and all of that user-facing proprietary code does tend to make Android feel much more closed than your typical Linux distro.
You cannot customize the Android OS – by default
While it’s typically pretty easy to modify a Linux distribution at the operating system level, by default Android owners cannot access the underlying operating system on their smartphone or tablet, and sensitive partitions are locked down tight. However, the by default is important, as you can gain access to areas of your device that are normally closed off, by exploiting security flaws in the Android system, in a process known as rooting.
So, while Android is considerably less customizable than your typical Linux distribution, there are ways to gain access to the underlying operating system.
Wrapping up
So, circling back to our original question: Is Android a Linux distribution? Ultimately (and frustratingly) it all hinges on how you define a Linux distro. If you agree that we should all be referring to Linux distros as GNU/Linux instead of Linux, then the answer is no, as Android includes very little GNU software.
If you define ‘Linux distro’ as an operating system that includes the Linux kernel and fulfills one or more additional criteria, then again, the answer is very likely to be no. Although every Android smartphone and tablet does include a Linux kernel, Android doesn’t completely fulfill any of the other characteristics commonly associated with Linux distros. For example, Android is very clearly the product of one company, it’s incompatible with regular Linux apps, and even though AOSP is open source, the version of Android you encounter on commercial devices feels considerably more closed than you’d expect from a Linux distro, thanks to the inclusion of user-facing proprietary code.
However, if your definition of a Linux distro is an operating system that’s based on the Linux kernel, then Android is a Linux distro. It may be an unusual, highly-specialized distro, but it’s every bit as much a distro as Ubuntu, Fedora, Debian, and any other operating system that’s based on the Linux kernel.
So what’s your take on this? Is Android a Linux distro because it includes the Linux kernel? Or does an operating system need to meet some additional criteria, in order to qualify as a Linux distro? Let us know in the comments!
Источник
Android
Contents
Transferring files
There are various ways to transfer files between a computer and an Android device:
- USB cable
- Media Transfer Protocol for modern Android devices
- USB mass storage for older devices
- Android Debug Bridge
- special USB sticks / regular USB stick with adapter
- Bluetooth
- Arch Linux software with Android counterparts
- client or server for protocols that can be used to transfer files (eg. SSH, FTP, Samba or HTTP)
- KDE Connect ( kdeconnect ) – integrates your Android device with the KDE or Gnome desktop (featuring synced notifications & clipboard, multimedia control, and file/URL sharing).
- cloud synchronization clients
- Syncthing
- sendanywhereAUR – cross-platform file sharing
- qrcpAUR – transfer files over wifi from your computer to your mobile device by scanning a QR code
App development
The officially supported way to build Android apps is to use #Android Studio.[1]
Android Studio
Android Studio is the official Android development environment based on IntelliJ IDEA. It provides integrated Android developer tools for development and debugging.
Android Studio creates a .android directory in home directory. To reset Android Studio, this directory can be removed.
The Android Studio Setup Wizard installs the required #SDK packages and places the SDK by default in
To build apps from the command-line (using e.g. ./gradlew assembleDebug ) set the ANDROID_SDK_ROOT environment variable to your SDK location.
SDK packages
Android SDK packages can be installed directly from upstream using #Android Studio’s SDK Manager or the sdkmanager command line tool (part of the Android SDK Tools). Some Android SDK packages are also available as AUR packages, they generally install to /opt/android-sdk/ .
Android SDK Package | SDK-style path | AUR package | AUR dummy | CLI tools |
---|---|---|---|---|
Command-Line Tools | tools | android-sdk-cmdline-tools-latest AUR | android-sdk-cmdline-tools-latest-dummy AUR | apkanalyzer, avdmanager, lint, retrace, screenshot2, sdkmanager |
SDK Build-Tools | build-tools;version | android-sdk-build-tools AUR | android-sdk-build-tools-dummy AUR | aapt, aapt2, aidl, apksigner, bcc_compat, d8, dexdump, dx, lld, llvm-rs-cc, mainDexClases, split-select, zipalign |
SDK Platform-Tools | platform-tools | android-sdk-platform-tools AUR | android-sdk-platform-tools-dummy AUR | adb, dmtracedump, e2fsdroid, etc1tool, #fastboot, hprof-conv, make_f2fs, make_f2fs_casefold, mke2fs, sload_f2fs, sqlite3, systrace |
SDK Platform | platforms;android-level | android-platform AUR , older versions | android-platform-dummy AUR (unnecessary) |
The android-tools package provides adb, #fastboot, e2fsdroid and mke2fs.android from the SDK Platform-Tools along with mkbootimg and ext2simg .
Android Emulator
The Android Emulator is available as the emulator SDK package, the android-emulator AUR package, and there is also a dummy package for it: android-emulator-dummy AUR .
To run the Android Emulator you need an Intel or ARM System Image. You can install them through the AUR[2], with the sdkmanager or using Android Studio’s AVD Manager.
Other SDK packages in the AUR
The Android Support Library is now available online from Google’s Maven repository. You can also install it offline through the extras;android;m2repository SDK package (also available as android-support-repository AUR ).
Making /opt/android-sdk group-writeable
The factual accuracy of this article or section is disputed.
The AUR packages install the SDK in /opt/android-sdk/ . This directory has root permissions, so keep in mind to run sdk manager as root. If you intend to use it as a regular user, create the android-sdk users group, add your user.
Set an access control list to let members of the newly created group write into the android-sdk folder. As running sdkmanager can also create new files, set the ACL as default ACL. the X in the default group entry means «allow execution if executable by the owner (or anyone else)»
Re-login or as log your terminal in to the newly created group:
Other IDEs
Android Studio is the official Android development environment based on IntelliJ IDEA. Alternatively, you can use Netbeans with the NBAndroid-V2. All are described below.
Netbeans
If you prefer using Netbeans as your IDE and want to develop Android applications, use NBAndroid-V2 .
Install android-sdk AUR package and follow the instructions from the NBANDROID README.
Vim / Neovim
It is possible to write flutter applications for Android and iOS using (Neo)vim like an IDE. Install coc using a Vim plugin manager. Also install the coc-flutter extension for autocompletion (like in Android Studio) and to load the code into an Android emulator.
Emacs
To develop a mobile flutter application using Emacs, as the the official instruction at flutter.dev suggests, install lsp-dart.
Other Tools
Marvin
Marvin is a tool which helps beginners set up an Android development environment. Installing marvin_dsc AUR helps you set up the following things: JDK, Android SDK, IDE(s), and AVD.
Building
Please note that these instructions are based on the official AOSP build instructions. Other Android-derived systems such as LineageOS will often require extra steps.
Required packages
As of 2020/April, to build either AOSP 10 or LineageOS 17.1 you need (possibly a subset of) base-devel , multilib-devel , gcc , repo , git , gnupg , gperf , sdl , wxgtk2 , squashfs-tools , curl , ncurses , zlib , schedtool , perl-switch , zip , unzip , libxslt , bc , rsync , ccache , lib32-zlib , lib32-ncurses , lib32-readline , ncurses5-compat-libs AUR , lib32-ncurses5-compat-libs AUR , and a TTF font installed (e.g. ttf-dejavu ). In particular, no Python2 or Java are required, as they are provided by AOSP/Lineage. The aosp-devel AUR metapackage provides them all for simple installation.
Additionally, LineageOS requires the following packages: xml2 AUR , lzop , pngcrush , imagemagick . They can be installed with the lineageos-devel AUR metapackage.
The factual accuracy of this article or section is disputed.
Java Development Kit
The required JDK version depends on the Android version you are building:
- For Android 9 (Pie) and up, Java is included with the Android source and no separate installation is needed.
- For Android 7 and 8 (Nougat and Oreo), OpenJDK 8 is required, which is available with the jdk8-openjdk package.
- For Android 5 and 6 (Lollipop and Marshmallow), OpenJDK 7 is required, which is available with the jdk7-openjdk package.
Set JAVA_HOME to avoid this requirement and match the Arch Linux installation path. Example:
This change will be valid only for the current terminal session.
Setting up the build environment
Create a directory to build.
The Android build process expects python to be python2. Prepend it to the PATH :
Alternatively, create a python2 virtual environment and activate it:
/android to reflect your build directory if different than above).
or (assuming build directory Data/Android_Build):
Downloading the source code
This will clone the repositories. You only need to do this the first time you build Android, or if you want to switch branches.
- The repo has a -j switch that operates similarly to the one used with make . Since it controls the number of simultaneous downloads, you should adjust the value depending on downstream network bandwidth.
- You will need to specify a branch (list of branches) to check out with the -b switch. If you leave the switch out, you will get the so-called master branch.
The -c switch will only sync the branch which is specified in the manifest, which in turn is determined by the branch specified with the -b switch, or the default branch set by the repository maintainer.
Wait a long time. Just the uncompiled source code, along with the .repo and .git directories that are used to keep track of it, are very large. As of Android 10, at least 250 GB of free disk space is required.
Building the code
This should do what you need for AOSP:
If you run lunch without arguments, it will ask what build you want to create. Use -j with a number between one and two times number of cores/threads.
The build takes a very long time.
Testing the build
When finished, run/test the final image(s).
Creating a flashable Image
To create an image that can be flashed it is necessary to:
This will create a zip image under out/target/product/hammerhead (hammerhead being the device name) that can be flashed.
Flashing
In some cases, you want to return to the stock Android after flashing custom ROMs to your Android mobile device. For flashing instructions of your device, please use XDA forums.
Fastboot
Fastboot (as well as ADB) is included in the android-tools package.
Samsung devices
Samsung devices cannot be flashed using Fastboot tool. Alternatives are Heimdall and Odin (by using Windows and VirtualBox).
samloader
To download original Samsung firmware, a platform independent script, samloader can be used.
Heimdall
Heimdall is a cross-platform open-source tool suite used to flash firmware (also known as ROMs) onto Samsung mobile devices and is also known as an alternative to Odin. It can be installed as heimdall .
The flashing instructions can be found on Heimdall’s GitHub repository or on XDA forums.
Odin (Virtualbox)
It is also possible to restore firmware (Android) on the Samsung devices using Odin, but inside the VirtualBox.
Arch Linux (host) preparation:
- Install VirtualBox together with its extension pack and guest additions.
- Install your preferred, but compatible with Odin, Windows operating system (with VirtualBox guest additions) into a virtual hard drive using VirtualBox.
- Open VirtualBox settings of your Windows operating system, navigate to USB, then tick (or make sure it is ticked) Enable USB 2.0 (EHCI) Controller.
- At VirtualBox running Windows operating system, click in the menu bar Devices > USB Devices, then click on your Samsung mobile device from the list, which is connected to your computer via USB.
Windows (guest) preparation:
Check if configuration is working:
- Turn your device into Download mode and connect to your Linux machine.
- In virtual machine toolbar, select Devices > USB > . Samsung. device.
- Open Odin. The white box (a big one at the bottom-left side) named Message, should print a line similar to this:
which means that your device is visible to Odin & Windows operating system and is ready to be flashed.
Use Android on GNU/Linux
There are several projects and methods which support running Android on GNU/Linux:
- Anbox: container-based software to run Android on Linux kernels
- Android-x86: a direct port of Android for the x86 architecture
Troubleshooting
Android Studio: Android Virtual Devices show ‘failed to load’.
Make sure you have exported the variable ANDROID_HOME as explained in #Android Studio.
Android Studio: ‘failed to create the SD card’
If you try to run an AVD (Android Virtual Device) under x86_64 Arch and get the error above, install the lib32-gcc-libs package from the multilib repository.
Eclipse: During Debugging «Source not found»
Most probably the debugger wants to step into the Java code. As the source code of Android does not come with the Android SDK, this leads to an error. The best solution is to use step filters to not jump into the Java source code. Step filters are not activated by default. To activate them: Window > Preferences > Java > Debug > Step Filtering. Consider to select them all. If appropriate you can add the android.* package. See the forum post for more information: http://www.eclipsezone.com/eclipse/forums/t83338.rhtml
ValueError: unsupported pickle protocol
One fix is to issue:
If that does not work, then try this:
libGL error: failed to load driver: swrast OR AVD does not load and no error message displayed
Sometimes, beginning to load an AVD will cause an error message similar to this to be displayed, or the loading process will appear to finish but no AVD will load and no error message will be displayed.
The AVD loads an incorrect version of libstdc++, you can remove the folder libstdc++ from
/.android-sdk/emulator/lib64 (for 64-bit) or
/.android-sdk/emulator/lib (for 32-bit) , e.g.:
Note that in versions before Android Studio 3.0, this directory was in a different location:
Alternatively you can set and export ANDROID_EMULATOR_USE_SYSTEM_LIBS in
Fix for the .desktop file might be achieved by using env command, prefixing the Exec line Desktop entries#Modify environment variables
sh: glxinfo: command not found
Here is the full error:
You can try to install glxinfo ( mesa-utils ) but if your computer has enough power you could simply use software to render graphics. To do so, go to Tools > Android > AVD Manager, edit the AVD (click the pencil icon), then select Software — GLES 2.0 for Emulated Performance > Graphics.
Android Emulator: no keyboard input in xfwm4
In xfwm4, the vertical toolbar buttons window that is on the right of the emulator takes focus from the emulator and consumes keyboard events. (bug report)
You can use the workaround described in [3]:
- Open the xfwm4 settings.
- Switch to the Focus tab.
- Change the Focus Model to «Focus follow mouse».
- Disable Automatically raise windows when they receive focus option below.\
Android Emulator: Window is shaking and blinking when used in WM tiled mode
When using Tiled Window Manager like dwm, Android Emulator will shake and blink. You can use the workaround described in krohnkite issue 72 (window floating is induced by Alt+f in dwm).
Android Emulator: Segmentation fault (core dumped)
When using Nouveau drivers try to disable gpu hardware acceleration.
In some devices it can only be done by editing $HOME/.avd/device_name.avd/config.ini .[4]
- Set hw.gpu.enabled=no
- Set hw.gpu.mode=off
adb: sideload connection failed: insufficient permissions for device
If you get the error:
you might solve it by restarting the adb server:
Источник