【发布时间】:2021-05-28 07:26:47
【问题描述】:
升级 Nativescript CLI v7.2.0 和 @nativescript/core 7.0.13 后,以前使用 tns-core-modules@6.1.1 的正常运行的 Nativescript 应用在 Android 模拟器上运行时失败。
我能找到的唯一升级和迁移信息是:
- https://docs.nativescript.org/releases/upgrade-instructions
- https://nativescript.org/blog/nativescript-7-import-reference/
- https://nativescript.org/blog/nativescript-7-announcement/
升级说明页面似乎特定于 v6,因此运行 ns migrate 可能不是正确的第一步。不过,NS 7 的公告帖子仍然说要使用它。
我完成的过程是升级 Nativescript CLI,运行 ns migrate,ns clean,重新添加 Android 平台(v7.0.1),然后将导入从 tns-core-modules 更新到他们抛出的 @nativescript/core webpack 构建错误。还必须修复之前从 tns-core-modules/platform 导入 screen 变量的逻辑,而现在需要 Screen。
在运行 ns build android 时清除这些错误后,webpack 现在正在构建应用程序,并在模拟设备上安装。安装时间比以前更长,但最终会出现应用启动画面。大约 1 秒后,启动屏幕会随着应用程序关闭而消失。控制台输出中没有任何信息,控制台只显示“已成功安装在标识符为 'emulator-5554' 的设备上。”
我可以使用任何其他工具来调试此问题吗?
【问题讨论】:
-
我能够使用 adb 的 logcat 看到有用的信息。问题是 nativescript-sentry 需要和更新以及要放置在 AndroidManifest 中的 DSN。现在,当启动应用程序时,它会崩溃并在设备上出现错误:“主”线程上发生未捕获的异常。无法启动活动 ComponentInfo{com.XYZ.app/com.tns.NativeScriptActivity}:com.tns.NativeScriptException:调用 js 方法 onCreate 失败 TypeError:无法读取未定义的属性“_leaveCb”
标签: android nativescript nativescript-vue