Hi,
Some times my app show this error when pass of background to foreground. This happen when back after I call another app (startActivity), as maps or internet navegator, or when my app go to background by somethings.
tns-android version: "2.1.0-2016-05-20-601"
com.tns.NativeScriptException: No weak reference found. Attempt to use cleared object reference id=-1186045808
com.tns.Runtime.getJavaObjectByID(Runtime.java:636)
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:861)
com.tns.Runtime.callJSMethodImpl(Runtime.java:726)
com.tns.Runtime.callJSMethod(Runtime.java:712)
com.tns.Runtime.callJSMethod(Runtime.java:693)
com.tns.Runtime.callJSMethod(Runtime.java:683)
com.tns.FragmentClass.onDestroyView(FragmentClass.java:46)
android.app.Fragment.performDestroyView(Fragment.java:2418)
android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1038)
android.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1253)
android.app.BackStackRecord.run(BackStackRecord.java:744)
android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1537)
android.app.FragmentManagerImpl$1.run(FragmentManager.java:482)
android.os.Handler.handleCallback(Handler.java:746)
android.os.Handler.dispatchMessage(Handler.java:95)
android.os.Looper.loop(Looper.java:148)
android.app.ActivityThread.main(ActivityThread.java:5443)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
It seems like a regression of #382. Can you send us a simple repro project or more detailed steps to reproduce? Is it enough to show a new (blank) activity and then do some navigation in order to get that error?
Hi @slavchev,
So, I don't know how this error is happening. It happens sometimes when the app goes from background back to foreground. I suspect that android is removing the memory from my app, maybe by system's low memory, and when I bring my app back to foreground the nativescript api think that the app state is the same before this supposed memory clean/remove. This make any sense? Can this happen?
Yes, the symptoms are the same as in #382. Probably it's a regression. I will review the code again though a small repro project would be more helpful.
repost from @AllanKr酶yer (posted on admin)
Hi, this bug is reported in our app in Google play store.
com.tns.NativeScriptException: No weak reference found. Attempt to use cleared object reference id=-1208919048
at com.tns.Runtime.getJavaObjectByID(Runtime.java:636)
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:861)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:726)
at com.tns.Runtime.callJSMethod(Runtime.java:712)
at com.tns.Runtime.callJSMethod(Runtime.java:693)
at com.tns.Runtime.callJSMethod(Runtime.java:683)
at com.tns.gen.android.app.DialogFragment_frnal_ts_helpers_l47_c38__DialogFragmentClassInner.onDestroyView(android.app.DialogFragment.java)
at android.app.Fragment.performDestroyView(Fragment.java:2370)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:974)
at android.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1188)
at android.app.BackStackRecord.run(BackStackRecord.java:799)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1468)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:451)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5930)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Hi,
Any solution to this bug?
Hi @mobilemindtec,
Can you provide a way to reproduce, a repo or steps to reproduce?
It's difficult for us to find a solution, when we can't reproduce the problem. It would be helpful if you could provide more information:
I @Plamen5kov,
I go try reproduce at small app.
Device: Moto G 2
"tns-android": "2.0.0"
"tns-core-modules": "^2.0.1"
@mobilemindtec did you have any success reproducing this issue?
@mobilemindtec we haven't heard from you in a while, so we are closing the issue, but feel free to reopen it.
This issue is still present in 2.5.0.
It is very random. Happens sometimes when navigating between Pages.
(too bad the "Copy to clipboard" button cuts the stack-trace in half)
An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException: No weak reference found. Attempt to use cleared object reference id=-619836880
at com.tns.Runtime.getJavaObjectByID(Runtime.java:971)
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1197)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1061)
at com.tns.Runtime.callJSMethod(Runtime.java:1047)
at com.tns.Runtime.callJSMethod(Runtime.java:1028)
at com.tns.Runtime.callJSMethod(Runtime.java:1018)
at com.tns.gen.android.transition.Transition_TransitionListener.onTransitionEnd(android.transition.Transition$TransitionListener.java)
at android.transition.Transition.end(Transition.java:1924)
at android.transition.Transition$3.onAnimationEnd(Transition.java:1875)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:766)
at android.animation.ValueAnimator$Ani
@manijak could you give us a little more information. Are you using a device or an emulator? What api level?
Sorry about that. Honestly, I've only seen this in my emulator (Genymotion). I've also tried to reproduce this on two different Android devices, but no luck. (One running 5.x.x the other 7.x.x).
What is bothering me is that I published a new version of my app this weekend, and GoogleAnalytics has already logged this exception 16 times. So users are seeing it... could be on low-end devices.
API level is 25.x
I have to agree I have seen this about once a week on my app out in the wild.
Most helpful comment
@manijak could you give us a little more information. Are you using a device or an emulator? What api level?