Skip to content

Latest commit

 

History

History
92 lines (58 loc) · 4.26 KB

README.md

File metadata and controls

92 lines (58 loc) · 4.26 KB

Android Studio Flatpak Wrapper

This community-provided package is not verified by, affiliated with, or supported by Android Open Source Project.

Filesystem visibility is voluntarily limited to home, and flatpak-spawn is not permitted because it would reduce security. If you need, you can extend filesystem visibility and add extra permissions.

Any suggestions, problem reports, or improvement proposals are welcome.

Distribution as extra-data problem

The Flatpak does not redistribute anything from AOSP but instead downloads the official archive at install time from the Google servers. Each update requires to download the full archive (no support for partial / delta updates). The archive is not deleted (the application always requires the additional space of the extra-data archive)

We are asking Google for permission to redistribute: if you actively use this package, please star and/or +1 this issue: https://issuetracker.google.com/issues/523371278

Android udev Rules

Many systems need udev rules to handle USB devices, we suggest these: android-udev-rules.

ADB SystemD Service

If you want to start ADB Server Daemon on user login (and not on Android Studio boot), this is a SystemD service example.

To disable management by Android Studio go, to:

  1. "Settings",
  2. "Build, Execution, Deployment",
  3. "Debugger", and
  4. "ADB server lifecycle management".

Then, select "Use existing manually managed server".

[Unit]
Description=Android Debug Server Daemon

[Service]
Type=forking
ExecStart=%h/android/sdk/platform-tools/adb start-server
ExecStop=%h/android/sdk/platform-tools/adb kill-server

[Install]
WantedBy=default.target

AVD Emulator

Wayland

By default, Android Studio now runs on Wayland, however the AVD Emulator still runs on X11 (XWayland) due to missing the latest Qt libraries with Wayland support.

Since the fallback-x11 socket is included in the manifest to cater for users on X11 an issue arise where AVD stops working. This happens due to the fallback-x11 permission hiding X11 completely when Wayland is detected.

To make AVD work again you need to explicitly enable X11 by granting Flatpak the --socket=x11 permission. Additionally, you need to remove the default fallback-x11 socket:

flatpak override --user --nosocket=fallback-x11 --socket=x11 com.google.AndroidStudio

SELinux

Some OSes (at least, Fedora and RHEL) enable SELinux, which restricts what unusual actions applications can perform without previous authorisation, in order to improve security. However, complex applications, like Android Studio's AVD Manager, need to be able to bypass this, in order to perform such low-level actions. Unfortunately, Flatpak does not yet support configuring this automatically, so the user must.

On these OSes, when an AVD is invoked without the override active, gnome-abrt shall inform the user that qemu-system-x86 has SIGABRT'd. To prevent this, apply the undermentioned override:

#!/usr/bin/env sh
sudo ausearch -c 'RenderThread' --raw | audit2allow -M my-RenderThread && \
sudo semodule -X 300 -i my-RenderThread.pp

Because this is a matter of security, on Fedora, the user can install sealert, which shall appear when gnome-abrt does, and inform the user that this approach is correct. It is an official Red Hat tool.

Alternatively, use setsebool to set the SELinux boolean for only the current boot session (this might be advantageous security-wise if you don't need the AVD Manager often):

sudo setsebool selinuxuser_execheap true

Or if it is preffered that the boolean persist across reboots, use the -P option:

sudo setsebool -P selinuxuser_execheap true

On copy-on-write filesystems

It's recommended to disable the copy-on-write behavior of the AVD Manager storage folder in order to run Android Virtual Devices without performance penalties. Most filesystems with this behavior (eg. BTRFS, ZFS, Bcachefs, etc.) support changing this configuration on a per-folder basis:

#!/usr/bin/env sh
chattr +C $HOME/.var/app/com.google.AndroidStudio/config/.android/avd

Important

This should only be done once, before creating any virtual devices. AVDs created prior won't be affected.