Ubuntu 16.04中Android Studio后台运行但无法在主屏启动求助
Hey there, I’ve dealt with this exact frustrating issue on Ubuntu 16.04 before—you launch Android Studio, see it chugging along in the background, but no window ever pops up on your main screen. Let’s walk through some tried-and-true fixes to get it displaying properly:
1. Force Disable HiDPI Scaling (Common Culprit)
Ubuntu 16.04’s display scaling often clashes with Android Studio’s UI rendering, especially on high-res screens. Here’s how to override it:
- Locate the Android Studio startup script, usually at
/opt/android-studio/bin/studio.sh(adjust the path if you installed it in a custom location). - Open it with a text editor (e.g.,
sudo nano /opt/android-studio/bin/studio.sh). - Add this line at the very top, before any other commands:
export _JAVA_OPTIONS="-Dsun.java2d.uiScale=1" - Save the file and restart Android Studio.
2. Reset Off-Screen Window Position
Sometimes the app window gets stuck outside your visible screen area. Use wmctrl to yank it back:
- First, install
wmctrlif you don’t have it:sudo apt-get install wmctrl - List all open windows to find Android Studio’s unique ID:
Look for the entry with "Android Studio" in the name—the first number is its window ID.wmctrl -l - Move the window to your main screen (adjust the width/height values to match your display):
wmctrl -i -r <YOUR_WINDOW_ID> -e 0,0,0,1280,720
3. Switch to Oracle JDK 8 (Avoid OpenJDK Compatibility Glitches)
Ubuntu 16.04’s default OpenJDK can cause UI rendering bugs with Android Studio. Oracle JDK 8 is far more reliable here:
- Add the WebUpd8 PPA to access Oracle JDK packages:
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update - Install JDK 8 and set it as your system default:
sudo apt-get install oracle-java8-installer sudo apt-get install oracle-java8-set-default - Verify the installation worked:
You should see output showingjava -versionjava version "1.8.x".
4. Wipe Corrupted Configuration Cache
If none of the above works, a damaged config folder might be breaking the UI load:
- First, kill all running Android Studio processes:
ps aux | grep android-studio | awk '{print $2}' | xargs kill - Delete the configuration directory (replace
<VERSION>with your Android Studio version, like4.2):rm -rf ~/.AndroidStudio<VERSION> - Launch Android Studio again—it’ll rebuild fresh config files from scratch.
If all else fails, try downloading the latest Android Studio package directly, extract it, and run the studio.sh script from the extracted folder. The Ubuntu Software Center version sometimes has unresolved dependency quirks that cause this issue.
内容的提问来源于stack exchange,提问作者Harshit

