无法读取未定义

时间:2016-09-07 04:44:21

标签: nativescript

我正在尝试浏览示例 - Groceries教程,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寻找解决方案。它在那里,但我错过了那个大的浅蓝色警告框:

enter image description here

1 个答案:

答案 0 :(得分:1)

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

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