NativeScript: Problem on suspend and resume app.
Having a problem to resume app. When in the main page, press “back” button which goes to suspend mode. When resume the app, UI got mess up. No idea what goes wrong. Use adb logcat to capture below error.
Happening on emulator and real device.
Suspend (press back button):
W/AudioTrack( 1565): AUDIO_OUTPUT_FLAG_FAST denied by client
E/EGL_emulation( 1132): tid 1132: eglCreateSyncKHR(1299): error 0x3004 (EGL_BAD_ATTRIBUTE)
W/EGL_emulation( 2029): eglSurfaceAttrib not implemented
W/OpenGLRenderer( 2029): Failed to set EGL_SWAP_BEHAVIOR on surface 0xa4490ce0, error=EGL_SUCCESS
W/ResourceType( 1909): No package identifier when getting value for resource number 0x00000000
W/PackageManager( 1909): Failure retrieving resources for com.app.contact: Resource ID #0x0
E/art (13727): invalid stream - problem with parameter iterator in /data/app/com.app.contact-1/base.apk for method void com.tns.gen.android.app.Application_ActivityLifecycleCallbacks.onActivityResumed(android.app.Activity)
E/WindowManager(13727):
E/WindowManager(13727): android.view.WindowLeaked: Activity com.tns.NativeScriptActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{1a0426a2 G.E..... R.....I. 0,0-684,0} that was originally added here
E/WindowManager(13727): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:363)
E/WindowManager(13727): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:271)
E/WindowManager(13727): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
E/WindowManager(13727): at android.app.Dialog.show(Dialog.java:298)
E/WindowManager(13727): at com.tns.Runtime.callJSMethodNative(Native Method)
E/WindowManager(13727): at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:865)
E/WindowManager(13727): at com.tns.Runtime.callJSMethodImpl(Runtime.java:730)
E/WindowManager(13727): at com.tns.Runtime.callJSMethod(Runtime.java:716)
E/WindowManager(13727): at com.tns.Runtime.callJSMethod(Runtime.java:697)
E/WindowManager(13727): at com.tns.Runtime.callJSMethod(Runtime.java:687)
E/WindowManager(13727): at com.tns.gen.android.app.Application_ActivityLifecycleCallbacks.onActivityResumed(android.app.Application$ActivityLifecycleCallbacks.java)
E/WindowManager(13727): at android.app.Application.dispatchActivityResumed(Application.java:208)
E/WindowManager(13727): at android.app.Activity.onResume(Activity.java:1220)
E/WindowManager(13727): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1257)
E/WindowManager(13727): at android.app.Activity.performResume(Activity.java:6076)
E/WindowManager(13727): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2975)
E/WindowManager(13727): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3017)
E/WindowManager(13727): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
E/WindowManager(13727): at android.app.ActivityThread.access$800(ActivityThread.java:151)
E/WindowManager(13727): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
E/WindowManager(13727): at android.os.Handler.dispatchMessage(Handler.java:102)
E/WindowManager(13727): at android.os.Looper.loop(Looper.java:135)
E/WindowManager(13727): at android.app.ActivityThread.main(ActivityThread.java:5254)
E/WindowManager(13727): at java.lang.reflect.Method.invoke(Native Method)
E/WindowManager(13727): at java.lang.reflect.Method.invoke(Method.java:372)
E/WindowManager(13727): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/WindowManager(13727): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
I/Choreographer(13727): Skipped 38 frames! The application may be doing too much work on its main thread.
W/WindowManager( 1565): Failed looking up window
W/WindowManager( 1565): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@3e6e356c does not exist
W/WindowManager( 1565): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8540)
W/WindowManager( 1565): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8531)
W/WindowManager( 1565): at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2593)
W/WindowManager( 1565): at com.android.server.wm.Session.remove(Session.java:187)
W/WindowManager( 1565): at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:233)
W/WindowManager( 1565): at com.android.server.wm.Session.onTransact(Session.java:130)
W/WindowManager( 1565): at android.os.Binder.execTransact(Binder.java:446)
W/OpenGLRenderer( 2029): Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
Resume (pick the app):
W/AudioTrack( 1565): AUDIO_OUTPUT_FLAG_FAST denied by client
I/ActivityManager( 1565): START u0 {act=com.android.systemui.recents.SHOW_RECENTS flg=0x10804000 cmp=com.android.systemui/.recents.RecentsActivity} from uid 10012 on display 0
W/EGL_emulation( 1909): eglSurfaceAttrib not implemented
W/OpenGLRenderer( 1909): Failed to set EGL_SWAP_BEHAVIOR on surface 0xa384f340, error=EGL_SUCCESS
W/AudioTrack( 1565): AUDIO_OUTPUT_FLAG_FAST denied by client
I/ActivityManager( 1565): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10300000 cmp=com.app.contact/com.tns.NativeScriptActivity bnds=[376,765][524,949] (has extras)} from uid 10007 on display 0
V/WindowManager( 1565): addAppToken: AppWindowToken{197294a3 token=Token{28e8ebd2 ActivityRecord{1798765d u0 com.app.contact/com.tns.NativeScriptActivity t1765}}} to stack=1 task=1765 at 0
W/AudioTrack( 1565): AUDIO_OUTPUT_FLAG_FAST denied by client
V/WindowManager( 1565): Adding window Window{66b1b59 u0 com.app.contact/com.tns.NativeScriptActivity} at 4 of 10 (after Window{303a927a u0 com.android.settings/com.android.settings.Settings})
V/WindowManager( 1565): Adding window Window{248fd7ff u0 com.app.contact/com.tns.NativeScriptActivity} at 4 of 11 (before Window{66b1b59 u0 com.app.contact/com.tns.NativeScriptActivity})
W/EGL_emulation(13727): eglSurfaceAttrib not implemented
W/OpenGLRenderer(13727): Failed to set EGL_SWAP_BEHAVIOR on surface 0xa2f40e00, error=EGL_SUCCESS
I/ActivityManager( 1565): Displayed com.app.contact/com.tns.NativeScriptActivity: +558ms
Window android
>tns info
All NativeScript components versions information
┌──────────────────┬─────────────────┬────────────────┬───────────────┐
│ Component │ Current version │ Latest version │ Information │
│ nativescript │ 2.3.0 │ 2.3.0 │ Up to date │
│ tns-core-modules │ 2.3.0 │ 2.3.0 │ Up to date │
│ tns-android │ 2.3.0 │ 2.3.0 │ Up to date │
│ tns-ios │ │ 2.3.0 │ Not installed │
└──────────────────┴─────────────────┴────────────────┴───────────────┘
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (8 by maintainers)
@vjoao, I had difficult to find the leak came from but finally found it is LoadingIndicator. The solution is very simple. Just add the dismiss() shown below and the problem gone.
Again, this is just “work” solution but it is not necessary the right place to add. Since hide is hide, it is kind of strange to dismiss but the author is more like doing destroying the dialog as it set progressDialog to undefined already. There are many other concerns I have such as whether it should separate hide and dismiss. Conceptually, it should and dismiss only call once. I think this is needed to be tested well but I don’t have time to prove this. If you are interested to refine this part, kindly to share. For now, I use the simplest solution and report back to author and let him to decide what to do.
If you any question about above, you could text me.