NativeScriptException:导航堆栈损坏

时间:2016-04-13 04:55:11

标签: android exception nativescript

我正在使用NativeScript 1.7.0创建我的第一个应用程序(目前是android平台),我遇到了这个错误,当按某些页面上的后退按钮时会不时崩溃应用程序。我不确定这种情况的确切条件是什么。

之前还有其他人遇到过这个吗?任何想法为什么会发生这种情况以及如何解决或避免它?

NativeScript 1.7.0 tns-core-modules ^ 1.7.1 tns-android 1.7.1

以下是有关控制台中打印的异常的信息:

com.tns.NativeScriptException: 
Calling js method onBackPressed failed

Error: Corrupted navigation stack; page: undefined; currentNavigationPage: undefined
File: "/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame.js, line: 664, column: 43

StackTrace: 
    Frame: function:'Frame._processNavigationQueue', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame-common.js', line: 173, column: 19
    Frame: function:'_completePageAddition', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/transition/transition.js', line: 228, column: 15
    Frame: function:'_onFragmentShown', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/transition/transition.js', line: 197, column: 9
    Frame: function:'onFragmentShown', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame.js', line: 43, column: 22
    Frame: function:'FragmentClass.onCreateView', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame.js', line: 537, column: 13
    Frame: function:'NativeScriptActivity.onBackPressed', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame.js', line: 664, column: 44


    at com.tns.Platform.callJSMethodNative(Native Method)
    at com.tns.Platform.dispatchCallJSMethodNative(Platform.java:816)
    at com.tns.Platform.callJSMethod(Platform.java:715)
    at com.tns.Platform.callJSMethod(Platform.java:694)
    at com.tns.Platform.callJSMethod(Platform.java:684)
    at com.tns.NativeScriptActivity.onBackPressed(NativeScriptActivity.java:41)
    at android.app.Activity.onKeyUp(Activity.java:2179)
    at android.view.KeyEvent.dispatch(KeyEvent.java:2650)
    at android.app.Activity.dispatchKeyEvent(Activity.java:2424)
    at com.tns.NativeScriptActivity.dispatchKeyEvent(NativeScriptActivity.java)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1877)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3884)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3867)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3463)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3513)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3482)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3567)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3490)
    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3624)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3463)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3513)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3482)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3490)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3463)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3513)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3482)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3600)
    at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:3752)
    at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2022)
    at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1738)
    at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1729)
    at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:1999)
    at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:133)
    at android.os.Looper.loop(Looper.java:124)
    at android.app.ActivityThread.main(ActivityThread.java:5457)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:806)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
    at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:1)

请确保您使用的是tns-core-modules和平台的Android 1.7.1或更高版本。 NS的几个版本有一些导航问题。我的理解是它们都应该在v1.7.1中解决

要升级;切换到主项目目录并执行以下每个简单命令:

  • npm install tns-core-modules @ latest -s
  • tns平台删除android
  • tns platform add android

然后你可以输入“cat package.json”或“type package.json”,你应该看到v1.7.1或更高版本的平台和核心模块。