错误:升级到NativeScript 6.0时,预期“样式”为字符串数组

时间:2019-08-11 14:23:41

标签: nativescript-angular

对于我现有的5.3.2 Nativescript,当我尝试升级到NativeScript 6.0以合并一个插件时,无法在模拟器中启动该应用程序

我已经纠正了构建过程中的任何红线错误。这些错误与将所有TS文件包括在tsconfig.json文件中有关,这是我以前从未做过的。

The build result is located at: C:\Users\xxx\git\xxx\platforms\android\app\build\outputs\apk\debug\app-debug.apk
Installing on device xx.xx.xx.xx:5555...
Successfully installed on device with identifier 'xx.xx.xx.xx:5555'.
Restarting application on device xx.xx.xx.xx:5555...
Successfully synced application org.nativescript.xxx on device 192.168.24.102:5555.
ActivityManager: Start proc 7559:org.nativescript.xxx/u0a66 for activity org.nativescript.xxx/com.tns.NativeScriptActivity
JS: HMR: Hot Module Replacement Enabled. Waiting for signal.
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to start activity ComponentInfo{org.nativescript.xxx/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Expected 'styles' to be an array of strings.
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.xxx/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Expected 'styles' to be an array of strings.
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
System.err:     at android.app.ActivityThread.-wrap11(ActivityThread.java)
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
System.err:     at android.os.Looper.loop(Looper.java:148)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:5417)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
System.err: Caused by: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Expected 'styles' to be an array of strings.
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:1122)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1109)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1089)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1081)
System.err:     at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:19)
System.err:     at android.app.Activity.performCreate(Activity.java:6237)
System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
System.err:     ... 9 more
ActivityManager: Process org.nativescript.xxx(pid 7559) has died

虽然在构建,安装和同步过程中没有错误,但我不知道如何进一步排除故障。

1 个答案:

答案 0 :(得分:0)

尝试执行以下步骤(Android / iOS):

  1. 使用以下命令删除node_modules:- Android:-rm node_modules iOS:-rm -rf node_moduels
  2. 使用以下命令删除钩子:- rm钩子/ rm -rf钩子
  3. 使用以下命令删除平台:- rm platform / rm -rf platform 要么 tns平台删除android / ios
  4. 再次使用以下命令安装npm:- npm install
  5. 在您的项目中添加平台:- tns平台添加android / ios
  6. 再次运行您的项目:- tns运行android / ios --bundle