GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(devtools): show non-string ApplicationSettings values by NathanWalker · Pull Request #11580 · NativeScript/NativeScript

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

  • The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages.
  • There is an issue for the bug/feature this PR is for.
  • You have signed the CLA.
  • All existing tests are passing.
  • Tests for the changes are included. (The devtools package has no unit-test target yet. See the verification below.)

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@NathanWalker
fix(devtools): show non-string ApplicationSettings values
4646ceb
Closes #10513
@nx-cloud

nx-cloud Bot commented Oct 23, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

CatchABus
CatchABus reviewed Nov 12, 2026
View reviewed changes
Comment thread packages/devtools/src/impl/ApplicationSettingsKeyValueProvider.ts
}
getValue(key: string) {
return ApplicationSettings.getString(key);
// Android's typed getters throw ClassCastException when the stored value has a different type.

@CatchABus CatchABus Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the need here but it might also be a good idea to consider a feature implementation that allows retrieving any value.
Android provides getAll() to retrieve a copy(usually a copy) of the hash-map and allows retrieving the values as Objects using HashMap.get.
A thing that comes to mind is an Application.getAny for both platforms which could perhaps return object toString().
This is one way to help avoid unnecessary calls and ClassCastExceptions.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
farfromrefug
farfromrefug reviewed Nov 12, 2026
View reviewed changes
Comment thread packages/devtools/src/impl/ApplicationSettingsKeyValueProvider.ts
getValue(key: string) {
return ApplicationSettings.getString(key);
// Android's typed getters throw ClassCastException when the stored value has a different type.
const readers = [() => ApplicationSettings.getString(key), () => ApplicationSettings.getBoolean(key), () => ApplicationSettings.getNumber(key)];

@farfromrefug farfromrefug Nov 12, 2026

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that s really ugly. And if the stored data is the wrong type it is an app issue.
i would much prefer Application.getAny

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

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

Reviewers

@farfromrefug farfromrefug farfromrefug left review comments
+1 more reviewer
@CatchABus CatchABus CatchABus left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

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

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@NathanWalker @farfromrefug @CatchABus
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.