René's URL Explorer Experiment


Title: newDrawable on NULL object crash in ui/styling/background.android.ts · Issue #7954 · NativeScript/NativeScript · GitHub

Open Graph Title: newDrawable on NULL object crash in ui/styling/background.android.ts · Issue #7954 · NativeScript/NativeScript

X Title: newDrawable on NULL object crash in ui/styling/background.android.ts · Issue #7954 · NativeScript/NativeScript

Description: I do not know if this is a tns-core-modules issues, an android-runtime issue, or an issue with the nativescript-mapbox plugin that I am working on. I originally filed this with the android-runtime project here: NativeScript/android#1487 ...

Open Graph Description: I do not know if this is a tns-core-modules issues, an android-runtime issue, or an issue with the nativescript-mapbox plugin that I am working on. I originally filed this with the android-runtime ...

X Description: I do not know if this is a tns-core-modules issues, an android-runtime issue, or an issue with the nativescript-mapbox plugin that I am working on. I originally filed this with the android-runtime ...

Opengraph URL: https://github.com/NativeScript/NativeScript/issues/7954

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"newDrawable on NULL object crash in ui/styling/background.android.ts","articleBody":"I do not know if this is a tns-core-modules issues, an android-runtime issue, or an issue with the nativescript-mapbox plugin that I am working on.\r\n\r\nI originally filed this with the android-runtime project here: https://github.com/NativeScript/android-runtime/issues/1487\r\n\r\n**Environment**\r\n - CLI: 6.1.2\r\n - Cross-platform modules: 6.1.1\r\n - Android Runtime: 6.1.2\r\n - iOS Runtime:\r\n - Plugin(s):\r\n\r\n```\r\n  \"dependencies\": {\r\n    \"@angular/animations\": \"~8.2.0\",\r\n    \"@angular/common\": \"~8.2.0\",\r\n    \"@angular/compiler\": \"~8.2.0\",\r\n    \"@angular/core\": \"~8.2.0\",\r\n    \"@angular/forms\": \"~8.2.0\",\r\n    \"@angular/platform-browser\": \"~8.2.0\",\r\n    \"@angular/platform-browser-dynamic\": \"~8.2.0\",\r\n    \"@angular/router\": \"~8.2.0\",\r\n    \"nativescript-advanced-permissions\": \"^1.2.0\",\r\n    \"nativescript-mapbox\": \"file:../publish/dist/package\",\r\n    \"nativescript-angular\": \"~8.2.0\",\r\n    \"nativescript-theme-core\": \"~1.0.6\",\r\n    \"nativescript-ui-sidedrawer\": \"~7.0.0\",\r\n    \"reflect-metadata\": \"~0.1.12\",\r\n    \"rxjs\": \"^6.4.0\",\r\n    \"rxjs-compat\": \"^6.5.3\",\r\n    \"tns-core-modules\": \"~6.1.0\",\r\n    \"zone.js\": \"~0.9.1\"\r\n  },\r\n  \"devDependencies\": {\r\n    \"@angular/compiler-cli\": \"~8.2.0\",\r\n    \"@ngtools/webpack\": \"~8.2.0\",\r\n    \"@types/chai\": \"~4.1.7\",\r\n    \"@types/mocha\": \"~5.2.5\",\r\n    \"@types/node\": \"~10.12.18\",\r\n    \"chai\": \"~4.1.2\",\r\n    \"codelyzer\": \"~4.5.0\",\r\n    \"mocha\": \"~5.2.0\",\r\n    \"mocha-junit-reporter\": \"~1.18.0\",\r\n    \"mocha-multi\": \"~1.0.1\",\r\n    \"mochawesome\": \"~3.1.2\",\r\n    \"nativescript-dev-appium\": \"^6.1.2\",\r\n    \"nativescript-dev-webpack\": \"~1.2.0\",\r\n    \"node-sass\": \"^4.7.1\",\r\n    \"tslint\": \"~5.19.0\",\r\n    \"typescript\": \"~3.5.3\"\r\n  }\r\n```\r\nUsing Android Emulator with an API 28 image under Ubuntu 18.04 LTS with Android Studio:\r\n```\r\nAndroid Studio 3.5\r\nBuild #AI-191.8026.42.35.5791312, built on August 8, 2019\r\nJRE: 1.8.0_202-release-1483-b49-5587405 amd64\r\nJVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o\r\nLinux 4.15.0-38-generic\r\n```\r\n\r\n**Describe the bug**\r\n\r\nI am working on the NativeScript Mapbox plugin. My fork is here: https://github.com/Yermo/nativescript-mapbox\r\n\r\nThe crash can be replicated using the included demo-angular app and e2e test.\r\n\r\nSince upgrading Nativescript to NS 6+, I am experiencing a random crash when navigating away from a page containing a map and removing the map container when running with \"markingMode\":\"none\".\r\n\r\nI do not know if the map plugin code is causing the instability as I have not been able to reproduce this problem navigating away from other pages, but the crash happens after the navigation has completed and the map view and object have been destroyed leading me to believe that maybe this is not my bug.\r\n\r\nThe map object is quite large so when doing lateral navigation ideally I want to destroy the mapbox view. I do this by wrapping the Mapbox tag in container with an *ngIf. Before navigating away the *ngIf condition is set to false and I wait for the mapbox onDestroy to return before proceeding with the navigation (thinking maybe there's a race condition somewhere.)\r\n\r\nAfter a random number of navigations between the map page and the test-crash page in the demo-angular app, it will crash on https://github.com/NativeScript/NativeScript/blob/430c616b938f8b78cd6b8c4917637f2d7b2aceee/tns-core-modules/ui/styling/background.android.ts#L86\r\nwhen navigating /to/ the test-crash page with the error:\r\n\r\n```\r\nJNI DETECTED ERROR IN APPLICATION: can't call android.graphics.drawable.Drawable android.graphics.drawable.ColorDrawable$ColorState.newDrawable(android.content.res.Resources) on null object\r\n```\r\n\r\ncachedDrawable in this case is not null on the javascript side so I suspect a markingMode: \"none\" issue. Adding a line of code to the javascript:\r\n```\r\nif ( cachedDrawable == null ) {\r\n\tconsole.log( \"background.android.js - cachedDrawable is NULL ---------------\" );\r\n} else {\r\n        console.log( \"background.android.js - cachedDrawable is:\", cachedDrawable );\r\n}\r\n```\r\nCauses a crash on the second console.log with the error can't call toString() on null object.\r\n\r\n**To Reproduce**\r\nClone my repository:\r\n https://github.com/Yermo/nativescript-mapbox\r\n```\r\ncd nativescript-mapbox/src\r\nnpm run build.dist\r\ncd ../demo-angular\r\ntns build android\r\nnpm run e2e -- --runType android28\r\n```\r\n(or whatever emulator you have)\r\nIt will crash between 3 and 100 iterations of navigating between the map page and the crash-test page. \r\n\r\n**Expected behavior**\r\n\r\nIdeally, it should not crash.\r\n\r\n**Sample project**\r\n https://github.com/Yermo/nativescript-mapbox/demo-angular\r\n\r\n**Additional context**\r\nI am motivated to solve this problem as it is a blocking issue for me that has cost me a few weeks now. \r\nIt is entirely possible that something I am doing in my plugin is mucking up the works, but I have attempted to follow all the guides and recommendations for writing plugins. I am not the original Mapbox plugin author but am largely taking over development of that plugin. \r\n\r\nIf no one has the free cycles to look into this, could I maybe get some pointers on how I might try to track this down? \r\nIs there a way to test a NativeScript/Javascript object to see if the corresponding Java object has been freed or is set to NULL? ","author":{"url":"https://github.com/Yermo","@type":"Person","name":"Yermo"},"datePublished":"2019-10-12T21:15:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/7954/NativeScript/issues/7954"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:61494105-2317-a975-a243-5a2fe872ed9d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD94A:1AD267:4F6FF59:6BA972A:69731A24
html-safe-nonce17f67c0651811300bcc39926ce15e63122ff8620850722309ee1b527e0adebc7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTRBOjFBRDI2Nzo0RjZGRjU5OjZCQTk3MkE6Njk3MzFBMjQiLCJ2aXNpdG9yX2lkIjoiNzA5NDgxNzE4MzM3NTc1OTkwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac4a583e56fe778880474c0888aa5be656e52bffb91eb52e0ae7f5195375f08d78
hovercard-subject-tagissue:506238458
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/7954/issue_layout
twitter:imagehttps://opengraph.githubassets.com/cdba0093c77c93b4b3b604223a14ea73175291707cd16f4c25d1c85c3b13f3bc/NativeScript/NativeScript/issues/7954
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/cdba0093c77c93b4b3b604223a14ea73175291707cd16f4c25d1c85c3b13f3bc/NativeScript/NativeScript/issues/7954
og:image:altI do not know if this is a tns-core-modules issues, an android-runtime issue, or an issue with the nativescript-mapbox plugin that I am working on. I originally filed this with the android-runtime ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameYermo
hostnamegithub.com
expected-hostnamegithub.com
None44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id31492490
octolytics-dimension-repository_nwoNativeScript/NativeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31492490
octolytics-dimension-repository_network_root_nwoNativeScript/NativeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasea5e2b48bd1260476599758f5d253b5d24092ab84
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/NativeScript/issues/7954#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fissues%2F7954
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fissues%2F7954
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NativeScript%2FNativeScript
Reloadhttps://github.com/NativeScript/NativeScript/issues/7954
Reloadhttps://github.com/NativeScript/NativeScript/issues/7954
Reloadhttps://github.com/NativeScript/NativeScript/issues/7954
NativeScript https://github.com/NativeScript
NativeScripthttps://github.com/NativeScript/NativeScript
Please reload this pagehttps://github.com/NativeScript/NativeScript/issues/7954
Notifications https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Fork 1.7k https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Star 25.4k https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Code https://github.com/NativeScript/NativeScript
Issues 869 https://github.com/NativeScript/NativeScript/issues
Pull requests 59 https://github.com/NativeScript/NativeScript/pulls
Discussions https://github.com/NativeScript/NativeScript/discussions
Actions https://github.com/NativeScript/NativeScript/actions
Projects 0 https://github.com/NativeScript/NativeScript/projects
Wiki https://github.com/NativeScript/NativeScript/wiki
Security 0 https://github.com/NativeScript/NativeScript/security
Insights https://github.com/NativeScript/NativeScript/pulse
Code https://github.com/NativeScript/NativeScript
Issues https://github.com/NativeScript/NativeScript/issues
Pull requests https://github.com/NativeScript/NativeScript/pulls
Discussions https://github.com/NativeScript/NativeScript/discussions
Actions https://github.com/NativeScript/NativeScript/actions
Projects https://github.com/NativeScript/NativeScript/projects
Wiki https://github.com/NativeScript/NativeScript/wiki
Security https://github.com/NativeScript/NativeScript/security
Insights https://github.com/NativeScript/NativeScript/pulse
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/NativeScript/issues/7954
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/NativeScript/issues/7954
#8475https://github.com/NativeScript/NativeScript/pull/8475
newDrawable on NULL object crash in ui/styling/background.android.tshttps://github.com/NativeScript/NativeScript/issues/7954#top
#8475https://github.com/NativeScript/NativeScript/pull/8475
bughttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22bug%22
help wantedhttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
marking-modehttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22marking-mode%22
needs more infohttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22needs%20more%20info%22
os: androidhttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22os%3A%20android%22
https://github.com/Yermo
https://github.com/Yermo
Yermohttps://github.com/Yermo
on Oct 12, 2019https://github.com/NativeScript/NativeScript/issues/7954#issue-506238458
NativeScript/android#1487https://github.com/NativeScript/android/issues/1487
https://github.com/Yermo/nativescript-mapboxhttps://github.com/Yermo/nativescript-mapbox
NativeScript/tns-core-modules/ui/styling/background.android.tshttps://github.com/NativeScript/NativeScript/blob/430c616b938f8b78cd6b8c4917637f2d7b2aceee/tns-core-modules/ui/styling/background.android.ts#L86
430c616https://github.com/NativeScript/NativeScript/commit/430c616b938f8b78cd6b8c4917637f2d7b2aceee
https://github.com/Yermo/nativescript-mapboxhttps://github.com/Yermo/nativescript-mapbox
https://github.com/Yermo/nativescript-mapbox/demo-angularhttps://github.com/Yermo/nativescript-mapbox/demo-angular
bughttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22bug%22
help wantedhttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
marking-modehttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22marking-mode%22
needs more infohttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22needs%20more%20info%22
os: androidhttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22os%3A%20android%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.