无法读取未定义的 属性 'targetNum'

Cannot read property 'targetNum' of undefined

我正在尝试完成示例杂货教程,在 iOS 平台上一切正常,但是当我尝试 tns run android --emulator 时,我收到 Cannot read property 'targetNum' of undefined 错误消息。

如果我这样做 ./gradlew buildapk --debug 我会得到这些错误的行:

23:35:07.082 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :processDebugResources FAILED
23:35:07.083 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :processDebugResources (Thread[main,5,main]) completed. Took 0.45 secs.
23:35:07.083 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 1.491 secs, idle: 0.011 secs
23:35:07.089 [ERROR] [org.gradle.BuildExceptionReporter] 
23:35:07.090 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
23:35:07.090 [ERROR] [org.gradle.BuildExceptionReporter] 
23:35:07.090 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
23:35:07.090 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':processDebugResources'.
23:35:07.090 [ERROR] [org.gradle.BuildExceptionReporter] > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1
23:35:07.091 [ERROR] [org.gradle.BuildExceptionReporter] 
23:35:07.091 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
23:35:07.091 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. 
23:35:07.092 [LIFECYCLE] [org.gradle.BuildResultLogger] 
23:35:07.092 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED

我已经 运行 tns doctor 并验证了 ANDROID_HOME 变量。还升级到最新的核心模块并尝试使用几个 cocoapods 版本,因为 tns 医生不断向我发送有关 CocoaPods 安装错误的警告。

编辑:感谢@dennis 找到解决方案。它在那里,但我错过了那个大大的浅蓝色警告框:

您是否设置了 Android 虚拟设备 (AVD)?它可能会给出该错误,因为没有 Android 模拟器可以连接。我能够在没有配置 AVD 的情况下使用新的 repo 重现错误,但是在我设置一个之后 tns run android --emulator 工作顺利。

如果您没有 AVD 设置,您可以使用 Android Studio 和本指南来启动 运行:https://developer.android.com/studio/run/managing-avds.html