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

fix(devtools): show non-string ApplicationSettings values - #11580

Open
NathanWalker wants to merge 1 commit into
mainfrom
fix/devtools-non-string-settings
Open

NathanWalker wants to merge 1 commit into
mainfrom
fix/devtools-non-string-settings

Conversation

@NathanWalker

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

The devtools Storage panel reads every ApplicationSettings key with ApplicationSettings.getString(key). On Android that's SharedPreferences.getString(), which throws java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String for any key stored with setBoolean or setNumber. As a result, opening Storage fails for any app with a non-string setting (#10513).

What is the new behavior?

ApplicationSettingsKeyValueProvider.getValue tries the string, boolean and number getters in turn and returns the first one that succeeds, as a string. Missing keys still return undefined. Writes are unchanged.

Verification: I ran a one-off Vitest spec against a mocked ApplicationSettings whose getters throw on a type mismatch, the way Android's do. String, boolean and number keys all read back as 'text', 'true' and '2.5', and the missing key stays undefined. The same spec fails without this change. tsc for packages/devtools reports no new errors.

Closes #10513.

@nx-cloud

nx-cloud Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 4646ceb

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 3m 21s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

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


☁️ Nx Cloud last updated this comment at 2026-10-23 20:39:10 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@11580
npm i https://pkg.pr.new/@nativescript/vite@11580
npm i https://pkg.pr.new/@nativescript/webpack@11580

commit: 4646ceb

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.

Devtools 0.0.1 Error: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String

1 participant