Guide for developing and debugging Android programs under FydeOS
Since Google announced the addition of the Android operating environment to Chrome OS in 2016, the Android ecosystem has a new entry-the desktop ring Android program that is suitable for large screens and keyboard and mouse operations. In the past 2 years, Google has made many improvements to the Android environment on Chrome OS to encourage more manufacturers and developers to participate. In May this year, the Project Crostini open source project led by Google added Chrome OS an experience closer to native Linux, Make it possible to complete daily development and debugging work on Chrome OS.
At this year ’s annual Google Developers Conference (Google io), we saw Chrome installed in a speech at “What’s new in Android apps for Chrome OS” The Google Pixelbook for OS implements support for large Linux programs like Android Studio and can directly debug and compile Android programs through adb and the onboard Android environment. This has a milestone effect on the promotion of the desktop Android ecosystem.
FydeOS is a desktop operating system product based on the secondary development of Chromium OS, decoupling the originally strongly bound Google services in the system, and adding self-developed modules and optimization, adapting to more hardware categories, so that more users can use it in mainland China without barriers.
The content after this article focuses on how to enable Linux (beta) in FydeOS, install and run the Linux program and cooperate with the onboard Android environment to achieve the high efficiency displayed on Chrome OS + Pixelbook on Google io (without using any emulator or virtual Machine) to debug Android programs.
0. Hardware requirements
Because large IDE programs such as Android Studio have high system performance requirements, we recommend installing FydeOS on hardware devices that are better than entry-level hardware. The following is the PC configuration for our test, for reference only:
- Intel Ivy-Bridge i5-3427U 1.8GHz
- 4GB RAM (occasionally there will be insufficient memory, so 8GB RAM is recommended)
- Integrated Intel HD Graphics 4000
- 128GB SSD
- At present, the Android environment of FydeOS (public beta version) is only compatible with Intel series graphics cards
- Since the architecture design of Project Crostini adopts the structure of virtual machine + container, it is required that the CPU has support for hardware virtualization (VT-x). In addition to the BayTrail family, most mid- to high-end Intel CPUs carry this feature.
Download, flash and load FydeOS and install it on the hard drive. The FydeOS official website and knowledge base have more detailed instructions, so I won’t repeat them here.
- The official download address of FydeOS here, and you can also get the mirror of the domestic network disk in Chinese Community.
- Instructions for flashing FydeOS to a mobile storage device and booting up here.
- If conditions permit, you can install FydeOS as the only system in the PC according to this tutorial, so that it can monopolize a whole hard disk; or you can according to this tutorial Coexist with FydeOS as a second system with other systems.
2. Enable Linux (beta)
Click “Settings”, and find the relevant setting items about “Linux (beta)”, as shown below:
Click “Enable” and click “Install” on the prompt box that pops up:
Depending on your hardware configuration, it takes a few minutes to install and enable Linux (beta) for the first time. After the installation is complete, FydeOS will add a new program called “Terminal” in the application launcher (click the lower left corner of the screen ⭕️ to enter), click the icon to start:
It can be seen that this is a fully functional Debian 9 (Stretch). Compared with the Crosh Shell that comes with FydeOS, this Terminal has its own complete and independent file system, where we can perform daily familiar Linux operations. FydeOS has set the default apt software source as a mirror of domestic Alibaba Cloud, you can also replace it according to your own preferences. You can update the Debian and install some commonly used tools with the following commands:
sudo apt-get update && sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get install wget unzip nano
FydeOS has mapped the user folder in Linux (beta) to the system’s own file manager. Through the “file” program in the program launcher, we can see that FydeOS has added the new option of “Linux file” And is the same as the home folder in Terminal:
3. Download, run Android Studio and install additional tools
We need to go to the official website developer.android.com to download Android Studio for Linux:
Here you can directly download the zip package through a browser, and copy it to the “Linux file” in the “File” program after completion; you can also copy the download link and download it directly from the Terminal using the command line:
After completion, we need to unzip the zip package and run the startup script to enable Android Studio:
cd /path/to/your/download/dir unzip android-studio-ide-173.4907809-linux.zip ./android-studio/bin/studio.sh
It can be seen that the Android Studio graphical interface starts immediately, and there is no obvious difference in experience from other Linux distributions. At this time, you need to initialize Android Studio according to the on-screen prompts, and download the required SDK and accessory tool set.
4. Enable FydeOS Android environment
After FydeOS runs for a few minutes, the system will automatically pull the latest version of the required system components from the FydeOS server, which includes “FydeOS Android Settings”. To activate and enable FydeOS’s Android operating environment, you need to run “FydeOS Android Settings” in the “Program Launcher”, agree to the relevant usage agreement, and the FydeOS Android Subsystem “Settings” program will start.
At present, FydeOS does not carry the application market provided by Google such as Google service framework and Play Store. To install the Android application, users can download the third-party Android market program or download the .apk file directly to install it. Android applications that have been successfully installed will automatically appear in the “Program Launcher”.
In order to develop and debug, we need to start the “adb debugging” function of FydeOS Android subsystem. The specific method is to click “FydeOS Android Settings” to open the “Settings” of the Android subsystem - “About the device” - click the “version number” 7 times in a row - return to the previous menu and select “Developer Options” - open “ADB debugging”:
5. Connect to ABD target in Linux environment
We need to allow the Android subsystem of FydeOS to establish an ADB connection with Android Studio.
The specific method is that when Android Studio is running, right-click the “Terminal” icon in the taskbar and select “Open New Window”. Run the following command in a new Terminal session:
sudo apt-get install adb adb connect 100.115.92.2:5555
At this point, the Android subsystem will receive the corresponding ADB connection request, and a confirmation window will pop up, you need to click “OK” to agree to the connection request:
6. Compile and debug Android programs in Android Studio
After completing the above steps, Android Studio will automatically add a “Connected devices” that can be used for debugging. We only need to checkout a compilable Android program project as usual. After completing Sync and Build, click “Run” and select the Android subsystem that was previously connected through ADB in the “Connected devices” dialog box that pops up. Real-time debugging:
7. Frequently asked questions and where to go for help
Q: What if my “Connected devices” is empty?
A: You can stop ADB and reconnect in a new Terminal session:
adb kill-server adb connect 100.115.92.2:5555
Q: What should I do if my Android Studio crashes?
A: You can pay attention to the
java_error_in_STUDIO_xxxx.log log file generated under “Linux File”, which is mostly caused by insufficient memory.
For more tips on using FydeOS and Linux (beta), please refer to FydeOS FAQ & Knowledge Base.
If you have more specific technical questions, you can post to FydeOS Chinese Community for help.