Cannot read property 'targetNum' of undefined

I'm trying to go through the sample-Groceries tutorial and everything goes fine on iOS platform but when I try tns run android --emulator I get a Cannot read property 'targetNum' of undefined error message.

If I do ./gradlew buildapk --debug I get these lines with errors:

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] > 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

I already run tns doctor and verified ANDROID_HOME variable. Also upgraded to the latest core modules and tried with a few cocoapods versions because tns doctor keeps sending me warnings about a bad CocoaPods installation.

EDIT: Thank you @dennis for finding a solution. It is there but I missed that big light blue warning box:

enter image description here


Have you set up an Android Virtual Device (AVD)? Chances are it's giving that error because there's no Android emulator to connect to. I was able to reproduce the error with a fresh repo with no AVD configured, but after I set one up tns run android --emulator worked smoothly.

If you don't have a AVD setup, you can use Android Studio and this guide to get up and running:


 ? Error: Cannot read property 'getCookie' of null when making http requests
 ? toggleDrawerState with Nativescript-telerik-ui slide drawer
 ? toggleDrawerState with Nativescript-telerik-ui slide drawer
 ? toggleDrawerState with Nativescript-telerik-ui slide drawer
 ? Nativescript: Controlling sideDrawer logically
 ? i have use two dropdown components in single page but only first of them is showing data not second one in nativescript ios
 ? NativeScript/Angular - Reactive form not working
 ? NativeScript ANDROID_HOME missing
 ? Developing Nativescript app with Local API
 ? TypeError: Cannot read property 'libelle' of undefined