You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was getting regular crashes aswell, excatly like described in the ticket. Nativescript's Sidekick has template with this issue, if you chose while creating a new prooject a project with sidedrawer, it has this bug in the app.component "[class.selected]="isComponentSelected('/sample')"
Then when navigating between different pages in the sidedrawer, it often pops out that error while app crashes. Sometimes with error reported, soometimes without error.
When this class.selected is removed, app works flawlessly
@ivandejesus The replacement is "strict" (required) to be sure that the fix is applied.
Since 6.2 "tns-core-modules" package can be replaced by "@nativescript/core" package.
See #7867 (comment)
I am using NativeScript v6.4.1 and Angular v8.3.25 and have found that after removing the [class.-selected]="isComponentSelected('/_some_route_')" lines from RadSideDrawer GridLayout elements, all crashes in my app suddenly went away, including those referencing Drawable. Might be a good place to start in eliminating them from your app as well, until the underlying bugs can be corrected.
For example, in my app.component.tns.html file, I removed the [class.-selected] attribute from all elements, such as to change the following GridLayout element...
@ebewley,
You are right ! removing the dynamic classes works for me too...
I changed a little bit isComponentSelected and no crashes too ( I hope.. ) :
import * as application from '@nativescript/core/application';
...
isComponentSelected (url: string): boolean {
const sideDrawer = <RadSideDrawer>application.getRootView();
if (!sideDrawer || !sideDrawer.getIsOpen()) {
return;
}
return this._activatedUrl === url;
}
@ebewley,
You are right ! removing the dynamic classes works for me too...
I changed a little bit isComponentSelected and no crashes too ( I hope.. ) :
import * as application from '@nativescript/core/application';
...
isComponentSelected (url: string): boolean {
const sideDrawer = <RadSideDrawer>application.getRootView();
if (!sideDrawer || !sideDrawer.getIsOpen()) {
return;
}
return this._activatedUrl === url;
}
@arturikoX@ebewley I left the dynamic class and just used rewritten isComponentSelected method and not issues so far (Android Emulator Pixel 9).
Hey, I don't know if it's related to general discussion. But if it can help anyone, I had similar problem where my app would crush sometimes when using *ngFor for custom navigation bar with [ngClass] or [class.selected] on children (Only with markingMode: none):
Would give me: "Attempt to use cleared object reference id=..." error
So, I've wrapped the inside ng component and replaced the the [class.selected] with *ngIf directive, which did the work. It's a bit ugly, but now it's not crushes:
The background-drawable caching that caused these "Attempt to use cleared object reference" crashes was fixed in #8475, and markingMode: none is now the default. Closing as completed. Please open a new issue with a repro if you still hit it on current @nativescript/core.
Activity
valera1401 commentedon Jul 27, 2019
I asked the same here
NativeScript/android#887 (comment)
devlfm commentedon Jul 31, 2019
I guess this is related #4204 too, and goes way back in time.. We still have no solution for this.
gkoulin commentedon Sep 23, 2019
Any news about this issue? I'm getting regular crashes too
[-]Android: Crash with "markingMode: none" ... Again (NS 5.4 / 6.0)[/-][+]Android: Crash with "markingMode: none" + navigation + backgroundColor change (NS 5.4 / 6.0)[/+]Skyless7 commentedon Oct 7, 2019
I was getting regular crashes aswell, excatly like described in the ticket. Nativescript's Sidekick has template with this issue, if you chose while creating a new prooject a project with sidedrawer, it has this bug in the app.component "[class.selected]="isComponentSelected('/sample')"
Then when navigating between different pages in the sidedrawer, it often pops out that error while app crashes. Sometimes with error reported, soometimes without error.
When this class.selected is removed, app works flawlessly
Yermo commentedon Oct 12, 2019
May be related to this: #7954
9 remaining items
flocca commentedon Nov 5, 2019
In 6.2 the workaround suggested by @jpierront needs to be updated:
jpierront commentedon Nov 26, 2019
@sandwai-scottjackman
npm install --save-dev string-replace-loader?ivandejesus commentedon Nov 26, 2019
Hi @jpierront,
having error when adding the script
ERROR in ../node_modules/tns-core-modules/ui/styling/background.js
Module build failed (from ../node_modules/string-replace-loader/index.js):
Error: Replace failed (strict mode) : defaultDrawable = cachedDrawable.newDrawable(nativeView.getResources()); → defaultDrawable = null;
at replace (/home/ivandejesus/Desktop/ams-pwa-native/node_modules/string-replace-loader/lib/replace.js:17:11)
at Object.processChunk (/home/ivandejesus/Desktop/ams-pwa-native/node_modules/string-replace-loader/lib/processChunk.js:11:17)
@ ../node_modules/@nativescript/core/ui/styling/style-properties.js 6:19-57
@ ../node_modules/@nativescript/core/ui/styling/css-animation-parser.js
@ ../node_modules/@nativescript/core/ui/styling/style-scope.js
@ ../node_modules/tns-core-modules/ui/styling/style-scope.js
@ ../node_modules/nativescript-dev-webpack/load-application-css.js
@ ../node_modules/nativescript-dev-webpack/load-application-css-angular.js
@ ./main.ts
jpierront commentedon Nov 26, 2019
@ivandejesus The replacement is "strict" (required) to be sure that the fix is applied.
Since 6.2 "tns-core-modules" package can be replaced by "@nativescript/core" package.
See #7867 (comment)
j99ht commentedon Dec 27, 2019
I do not see background.android.js in [email protected]
Any idea on how to implement the workaround for this release?
leocrawf commentedon Jan 7, 2020
Nativescript 6.3 now started using @nativescript/core so its now: node_modules/@nativescript/core/ui/styling/background.android.js
ebewley commentedon Mar 28, 2020
I am using NativeScript v6.4.1 and Angular v8.3.25 and have found that after removing the
[class.-selected]="isComponentSelected('/_some_route_')"lines from RadSideDrawer GridLayout elements, all crashes in my app suddenly went away, including those referencing Drawable. Might be a good place to start in eliminating them from your app as well, until the underlying bugs can be corrected.For example, in my app.component.tns.html file, I removed the [class.-selected] attribute from all elements, such as to change the following GridLayout element...
...to the following:
arturikoX commentedon Mar 29, 2020
@ebewley,
You are right ! removing the dynamic classes works for me too...
I changed a little bit isComponentSelected and no crashes too ( I hope.. ) :
srokatonie commentedon Apr 13, 2020
@arturikoX @ebewley I left the dynamic class and just used rewritten
isComponentSelectedmethod and not issues so far (Android Emulator Pixel 9).jpierront commentedon Apr 13, 2020
Any background color changes in any app may randomly cause a crash. As mentioned above, this hack fixes the problem:
Add this in webpack.config.js just before "return config'
Maybe one day the NativeScript team will find a fix ...
vahidvdn commentedon Apr 15, 2020
@jpierront It seems that this is fixed as mentioned here.
ibaraness commentedon Aug 1, 2020
Hey, I don't know if it's related to general discussion. But if it can help anyone, I had similar problem where my app would crush sometimes when using *ngFor for custom navigation bar with [ngClass] or [class.selected] on children (Only with markingMode: none):
Would give me: "Attempt to use cleared object reference id=..." error
So, I've wrapped the inside ng component and replaced the the [class.selected] with *ngIf directive, which did the work. It's a bit ugly, but now it's not crushes:
By the way, I couldn't do it outside of the component, because it would mess the order when selected item changes
NathanWalker commentedon Oct 23, 2026
The background-drawable caching that caused these "Attempt to use cleared object reference" crashes was fixed in #8475, and
markingMode: noneis now the default. Closing as completed. Please open a new issue with a repro if you still hit it on current@nativescript/core.