← 输入框|github.com|刷新
Skip to content

fix(android): isRealDevice returns false on emulators - #11575

Open
NathanWalker wants to merge 1 commit into
mainfrom
fix/android-is-real-device
Open

NathanWalker wants to merge 1 commit into
mainfrom
fix/android-is-real-device

Conversation

@NathanWalker

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

On Android, Utils.isRealDevice() gives the wrong answer. It returns true when Build.FINGERPRINT contains generic or vbox, which means it reports emulators as real devices and devices as not real. Current Android Emulator images also have fingerprints without generic (for example google/sdk_gphone64_arm64/emu64a:...), so a simple negation would still miss them. The iOS implementation is already correct.

What is the new behavior?

isRealDevice() returns false on the Android Emulator and on Genymotion, and true everywhere else. It detects emulators by:

  • Build.HARDWARE being goldfish or ranchu (the emulator's virtual boards), or
  • Build.FINGERPRINT starting with generic or containing vbox.

Nothing in core calls this on Android. Apps that worked around the inverted value will see it flip, so this should be called out in the release notes.

New unit tests in utils/native-helper-for-android.spec.ts cover a physical device, current and older emulator images, Genymotion, and missing build fields.

This makes the API match its documented contract, so the separate isSimulatorOrEmulator proposal in #9065 shouldn't be needed.

Closes #9064.

@nx-cloud

nx-cloud Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 66481fa

Command Status Duration Result
nx run-many -t build -p core,webpack5,vite ✅ Succeeded 23s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-23 19:31:52 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11575
npm i https://pkg.pr.new/@nativescript/vite@11575
npm i https://pkg.pr.new/@nativescript/webpack@11575

commit: 66481fa

This branch has not been deployed

No deployments
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.

There is no Utility to determine whether current execution is on a simulator or emulator

1 participant