Skip to content

fix: restore default Android SDK discovery - #152

Open
Nozomi-Hijikata wants to merge 1 commit into
okwasniewski:mainfrom
Nozomi-Hijikata:fix/android-emulator-discovery
Open

fix: restore default Android SDK discovery#152
Nozomi-Hijikata wants to merge 1 commit into
okwasniewski:mainfrom
Nozomi-Hijikata:fix/android-emulator-discovery

Conversation

@Nozomi-Hijikata

@Nozomi-Hijikata Nozomi-Hijikata commented Sep 4, 2026

Copy link
Copy Markdown

Thank you for building and maintaining this awesome tool! I ran into an issue where Android emulators were not appearing, so I investigated the onboarding and startup flow and put together this fix.

Summary:

MiniSim can complete onboarding with Android emulators enabled even when Android setup validation fails. The validation error is suppressed, so isOnboardingFinished can become true while androidHome remains unset.

After onboarding, the menu requests Android devices only when androidHome is already present in UserDefaults. That guard prevents ADB.getAndroidHome() from resolving the default ~/Library/Android/sdk location, so installing the SDK later does not restore Android emulator discovery automatically.

This change repairs that state before the menu is created:

  • when Android emulators are enabled and no SDK path is saved, resolve and validate the default SDK path
  • persist the path only when the existing emulator CLI can use it
  • preserve an existing custom SDK path
  • leave the preference unset when Android is disabled or no valid SDK is available

Performing this repair at startup is intentional. Fixing onboarding alone would not recover users who already completed it with a missing preference or who install the Android SDK later.

This PR does not change the onboarding validation UI or migrate from the legacy emulator executable to the new Android CLI. Those can be handled separately.

Refs #149

Changelog:

Restore Android emulator discovery when onboarding completed without saving the default Android SDK path.

Test Plan:

  • Added unit coverage for persisting a valid default SDK path, preserving a custom path, and rejecting an invalid SDK path.

  • Ran the full test suite successfully; the existing iOS device discovery test remained skipped.

  • Installed and launched the PR build from /Applications and verified these onboarding flows:

    • with a valid Android SDK, onboarding saved the default SDK path and completed normally
    • with Android enabled and the emulator executable temporarily unavailable, onboarding completed with isOnboardingFinished = true and no saved androidHome; Android menu entries were absent
    • after restoring the emulator executable and relaunching MiniSim, the default SDK path was persisted and the existing Android virtual device appeared in the menu
    • with Android disabled and no usable emulator executable, onboarding completed without saving androidHome, and Android menu entries remained absent

Recover when onboarding completes without persisting androidHome by validating the default SDK path at startup and saving it only when Android support is enabled and available.

Preserve custom SDK paths and iOS-only setups, and cover the fallback behavior with unit tests.
@Nozomi-Hijikata
Nozomi-Hijikata marked this pull request as ready for review September 4, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant