请求权限时模拟器出现System UI停止问题求助(真机正常)
Hey there, let's work through this frustrating System UI crash issue you're facing on your emulator. Since you've already tried the common fixes from those threads, let's jump into some targeted, less obvious solutions that might resolve this:
Wipe emulator data completely
Corrupted cache or permission-related leftover data is often the culprit here. Head to your AVD Manager, select the problematic emulator, click the three-dot menu (⋮), and choose "Wipe Data". This resets the emulator to a fresh out-of-the-box state, which frequently clears stubborn permission-triggered crashes.Switch to a different system image
Emulator bugs can be tied to specific API levels or image variants. Try testing with a different API version (e.g., if you're on API 33, give API 32 or 34 a shot) or switch between Google Play and Google APIs images. Don't forget to download the latest version of the image via the SDK Manager first.Turn off Instant Run temporarily
Instant Run can sometimes interfere with permission handling on emulators. Go to Android Studio Settings > Build, Execution, Deployment > Instant Run, uncheck "Enable Instant Run to hot swap code/resource changes on deploy", then run./gradlew clean buildto rebuild your project and restart the emulator.Double-check your permission request code
Even though it works on physical devices, emulators can be finicky about permission flows. Make sure you're using the modernActivityResultContracts.RequestMultiplePermissionsinstead of deprecated methods likecheckSelfPermission. Also, avoid requesting permissions in lifecycle callbacks that might clash with System UI (like a service'sonCreateor a non-visible activity's initialization).Tweak emulator hardware settings
- Boost RAM allocation: Open AVD Manager > Edit AVD > Show Advanced Settings > Memory and Storage, set the RAM to at least 2048MB. Low memory can cause unexpected UI crashes.
- Try software rendering: Switch the emulator's graphics setting to "Software - GLES 2.0" (found in the same advanced settings menu). Hardware acceleration sometimes causes rendering glitches that trigger System UI failures.
Reinstall the Android Emulator component
Corrupted emulator binaries might be the root cause. Go to SDK Manager > SDK Tools, uncheck "Android Emulator", click Apply to uninstall it, then recheck and reinstall it. This ensures you're working with a clean, up-to-date emulator installation.
内容的提问来源于stack exchange,提问作者João Carlos

