如何在Ubuntu 16.04中为Android Studio特定模拟器创建桌面启动器图标
Absolutely you can set up a dedicated launcher for your specific Android Studio emulator (like Nexus_4_API_27) on Ubuntu 16.04! I’ve done this dozens of times to skip the hassle of navigating through Android Studio’s AVD Manager every time—here’s exactly how to make it work:
Create a Custom Launcher for Nexus_4_API_27 Emulator on Ubuntu 16.04
Step 1: Confirm Your Emulator's Details & Launch Command
First, let’s lock in the exact info needed to launch your target emulator:
- Open a terminal and run this command to list all your installed AVDs (Android Virtual Devices):
You should seeemulator -list-avdsNexus_4_API_27in the output (if not, double-check your AVD Manager in Android Studio to ensure the emulator is properly set up). - Test the launch command to make sure it works:
If the emulator fires up, perfect. If not, you’ll need to use the full path to theemulator -avd Nexus_4_API_27emulatorexecutable (it’s usually in your Android SDK directory). For example:
Replace/home/your-username/Android/Sdk/emulator/emulator -avd Nexus_4_API_27your-usernamewith your actual Ubuntu username, and confirm this command launches the emulator successfully.
Step 2: Create the Desktop Launcher File
Ubuntu uses .desktop files for application launchers. We’ll create one in your user-specific folder so it only appears for your account:
- Open a terminal and run this command to create a new launcher file:
nano ~/.local/share/applications/nexus4-api27-emulator.desktop
Step 3: Fill in the Launcher Details
Paste the following content into the nano editor, then tweak the paths to match your system:
[Desktop Entry] Type=Application Name=Nexus 4 API 27 Emulator Comment=Launch Nexus 4 emulator running Android API 27 Exec=/home/your-username/Android/Sdk/emulator/emulator -avd Nexus_4_API_27 Icon=/home/your-username/Android/Sdk/platforms/android-27/res/drawable-xxhdpi/ic_launcher.png Terminal=false Categories=Development;Android;Emulator;
- Exec: Replace with the full working launch command you tested in Step 1.
- Icon: Use any icon you prefer. The path above uses a default Android icon from the API 27 platform files, but you could also use the Android Studio icon (
/home/your-username/android-studio/bin/studio.png) or a custom icon you download. - Save the file by pressing
Ctrl+O, hit Enter, then exit nano withCtrl+X.
Step 4: Make the Launcher Executable
Launcher files need execute permissions to function. Run this command:
chmod +x ~/.local/share/applications/nexus4-api27-emulator.desktop
Step 5: Test Your New Launcher
- Open the Ubuntu Dash (click the top-left icon or press the Super key) and search for "Nexus 4 API 27 Emulator".
- Click the icon—your emulator should launch directly, no need to open Android Studio first!
Troubleshooting Tips
- If the launcher doesn’t show up, log out and log back in (Ubuntu sometimes needs a refresh to detect new
.desktopfiles). - If the emulator fails to launch, double-check the
Execpath in the.desktopfile—typos here are the most common culprit. - For a system-wide launcher (visible to all users), create the file in
/usr/share/applications/instead of~/.local/share/applications/, and run the commands withsudo.
内容的提问来源于stack exchange,提问作者Anjan Biswas
相关产品推荐
相关产品推荐

