You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Fedora 28下Android Studio无法识别SDK及虚拟机启动失败求助

解决Fedora 28上Android Studio的SDK路径与模拟器启动问题

Hey there, let's break down your issues step by step—these are pretty common hurdles with AMD CPUs on Fedora, so I've got some practical fixes to share:

一、SDK路径找不到的问题

Even though you've set sdk.dir in local.properties and ANDROID_HOME, here are some checks to ensure everything is working as expected:

  • Verify local.properties location & permissions
    Make sure the file is in your project root directory (not inside a module folder). Check permissions with:
    ls -l local.properties
    
    If it's not readable by your user, fix it with:
    chmod 644 local.properties
    
  • Double-check environment variables
    Newer Android Studio versions sometimes prioritize ANDROID_SDK_ROOT over ANDROID_HOME. Add both to your shell config file (~/.bashrc or ~/.zshrc):
    export ANDROID_HOME=/home/USER/Android/Sdk
    export ANDROID_SDK_ROOT=$ANDROID_HOME
    
    Then apply the changes:
    source ~/.bashrc
    
    Confirm they're set with:
    echo $ANDROID_HOME && echo $ANDROID_SDK_ROOT
    
  • Sync Android Studio's SDK config
    Open File > Project Structure > SDK Location and confirm the path matches your ANDROID_HOME. Sometimes Studio overrides this after updates.
  • Clear Gradle cache
    Go to File > Invalidate Caches..., check "Invalidate and Restart"—this clears any cached path references that might be causing conflicts.

二、模拟器启动错误代码134(SIGABRT)

This is almost always related to AMD virtualization compatibility or missing system dependencies on Fedora. Try these fixes:

  • Confirm virtualization is fully enabled
    Check if CPU virtualization is active in the system:
    egrep -c '(vmx|svm)' /proc/cpuinfo
    
    If the output is 0, go back to your BIOS/UEFI and enable AMD-V (SVM) and IOMMU (some motherboards hide this under "Advanced CPU Settings").
  • Install required system packages
    Fedora might be missing libraries needed for the emulator. Install them with:
    sudo dnf install qemu-kvm libvirt virt-install bridge-utils
    
    Then start and enable the libvirt service:
    sudo systemctl start libvirtd
    sudo systemctl enable libvirtd
    
  • Adjust AVD settings
    1. Open AVD Manager, edit your Pixel 2/Nexus 6 emulator.
    2. Under Emulated Performance, set Graphics to Software (hardware acceleration can have AMD-specific bugs on Fedora).
    3. Reduce the allocated RAM (e.g., from 4GB to 2GB) to avoid memory conflicts with your host system.
  • Check SELinux restrictions
    Fedora's SELinux might block the emulator from accessing resources. Temporarily disable it to test:
    sudo setenforce 0
    
    If the emulator starts, add a permanent SELinux rule to allow it:
    sudo semanage fcontext -a -t emulator_exec_t '/home/USER/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64'
    sudo restorecon -v '/home/USER/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64'
    
  • Update Android Emulator
    Open SDK Manager > SDK Tools, check for updates to the Android Emulator. Newer versions often fix AMD compatibility issues.

三、Ubuntu vs Fedora for Android Development

Both distros work well for Android development, but there are small differences:

  • Ubuntu has a larger user base, so you'll find more pre-written fixes for AMD-specific emulator issues. Its default system configuration is often more "out-of-the-box" friendly for Android Studio.
  • Fedora offers newer software packages and a more up-to-date environment, which can be nice if you want the latest tools. Once you resolve the virtualization and dependency issues, it's just as reliable as Ubuntu.

I've been using Fedora with an AMD CPU for Android development for years now, and after sorting out these initial kinks, it's been smooth sailing.

内容的提问来源于stack exchange,提问作者user198881

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 06:39:47