NativeScript / android

NativeScript for Android using v8
https://docs.nativescript.org/guide/android-marshalling
Apache License 2.0
521 stars 135 forks source link

Android Build Error #533

Closed vchittar closed 8 years ago

vchittar commented 8 years ago

Whenever I try to build or run an android project I usually run into this problem.

FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':processF0F1F2F3F4F5DebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/23.0.2/aapt'' finished with non-zero exit value 1

Does anyone know why this problem occurs? I have been trying for a very long time to fix this and I cannot figure out how to do so.

Thanks!

petekanev commented 8 years ago

@vchittar we released NativeScript 2.2 today, so I strongly suggest you do a tns platform remove android, fetch the latest {N} version from npm npm install nativescript -g and attempt to build the application again.

Additionally I'd suggest that you update your android SDK if you haven't done that already.

And finally if neither of the above helps - you could manually invoke the gradle build with an additional flag to get a more detailed output of the error.

cd platforms/android
./gradlew buildapk --stacktrace
NathanaelA commented 8 years ago

@vchittar See my blog post on this subject; but I would agree with @Pip3r4o to upgrade your android tools...

http://fluentreports.com/blog/?p=359

vchittar commented 8 years ago

Yeah I tried all of that and didn't work.

This is the stacktrace output.


dhcp-10-5-28-21:android student$ ./gradlew buildapk --stacktrace
WARNING: The file: /Users/student/Desktop/Native_Script/Library/node_modules/nativescript-background-http/platforms/android/AndroidManifest.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0
WARNING: The file: /Users/student/Desktop/Native_Script/Library/node_modules/nativescript-calendar/platforms/android/README.md is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0
WARNING: The file: /Users/student/Desktop/Native_Script/Library/node_modules/nativescript-photoviewer/platforms/android/AndroidManifest.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0

:config phase:  createDefaultIncludeFiles
    +found plugins: nativescript-background-http
    +found plugins: nativescript-calendar
    +found plugins: nativescript-photoviewer
    +found plugins: nativescript-telerik-ui
    +found plugins: nativescript-web-image-cache
    +found plugins: tns-core-modules-widgets

:config phase:  createPluginsConfigFile
     Creating product flavors include.gradle file in /Users/student/Desktop/Native_Script/Library/platforms/android/configurations folder...

:config phase:  pluginExtend
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-background-http/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-calendar/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-photoviewer/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-telerik-ui/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-web-image-cache/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/android-upload-service.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/calendarpermissions-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/Common-2016.2.629-dev-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/Data-2016.2.629-dev-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/List-2016.2.629-dev-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/Primitives-2016.2.629-dev-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/widgets-release.aar
Observed package id '..;..;..;var;lib;android-sdk;samples;android-22' in inconsistent location '/usr/local/Cellar/android-sdk/24.4.1_1/samples/android-22' (Expected '/usr/local/Cellar/android-sdk/24.4.1_1/../../../var/lib/android-sdk/samples/android-22')

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'Library'.
> failed to find Build Tools revision 23.0.3

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'Library'.
    at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:510)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:90)
    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
    at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:125)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:122)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:33)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.IllegalStateException: failed to find Build Tools revision 23.0.3
    at com.android.builder.sdk.DefaultSdkLoader.getTargetInfo(DefaultSdkLoader.java:87)
    at com.android.build.gradle.internal.SdkHandler.initTarget(SdkHandler.java:126)
    at com.android.build.gradle.BasePlugin.ensureTargetSetup(BasePlugin.java:680)
    at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:617)
    at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:572)
    at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:569)
    at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
    at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
    at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:568)
    at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:565)
    at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
    at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
    at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
    at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy11.afterEvaluate(Unknown Source)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
    ... 44 more

BUILD FAILED
NathanaelA commented 8 years ago

Here is the key factor: failed to find Build Tools revision 23.0.3 You need to type "android" and install build tools 23.0.3...

vchittar commented 8 years ago

Yeah i installed the build version earlier but it still gives me the same error.

NathanaelA commented 8 years ago

You need that EXACT version installed; you can't use a earlier or LATER version. It specifically checks for that version... Either your ANDROID_HOME is not set properly or you do not have that specific version of the Build tools installed.

vchittar commented 8 years ago

/usr/local/Cellar/android-sdk/24.4.1_1/

This is my android home directory currently. I installed this version when I first installed NS.

vchittar commented 8 years ago

image

I have all of the installed and the path seems to be correct, but I still cant figure out why it doesnt work.

EDIT: Now I get this new error

Cannot read property 'targetNum' of undefined

Plamen5kov commented 8 years ago

Hi @vchittar Your android home directory should point to: /usr/local/Cellar/android-sdk. Try adding this to your config file if you want the change to be permanent:

export ANDROID_HOME="/usr/local/Cellar/android-sdk"
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools

You can also just paste them in a terminal and try building again, running the command in the same terminal.

vchittar commented 8 years ago

@Plamen5kov hey, that didnt work. It still keeps saying process failed for some reason even when I put in all these in the .profile file.

Plamen5kov commented 8 years ago

@vchittar can you post the fail message you're getting?

vekexasia commented 8 years ago
Execution failed for task ':processF0F1DebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/andrea/android-sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':processF0F1DebugResources'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
        at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
        at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/andrea/android-sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:207)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:82)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 60 more
Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/andrea/android-sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1
        at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:43)
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:983)
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:163)
        ... 68 more
Caused by: org.gradle.process.internal.ExecException: Process 'command '/home/andrea/android-sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1
        at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
        at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:41)
        ... 70 more
vchittar commented 8 years ago

This is my error:

`IDTStudentMBP:Library student$ tns build android
Project successfully prepared (android)
WARNING: The file: /Users/student/Desktop/Native_Script/Library/node_modules/nativescript-background-http/platforms/android/AndroidManifest.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0
WARNING: The file: /Users/student/Desktop/Native_Script/Library/node_modules/nativescript-calendar/platforms/android/README.md is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0
WARNING: The file: /Users/student/Desktop/Native_Script/Library/node_modules/nativescript-photoviewer/platforms/android/AndroidManifest.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0

:config phase:  createDefaultIncludeFiles
    +found plugins: nativescript-background-http
    +found plugins: nativescript-calendar
    +found plugins: nativescript-photoviewer
    +found plugins: nativescript-telerik-ui
    +found plugins: nativescript-web-image-cache
    +found plugins: tns-core-modules-widgets

:config phase:  createPluginsConfigFile
     Creating product flavors include.gradle file in /Users/student/Desktop/Native_Script/Library/platforms/android/configurations folder...

:config phase:  pluginExtend
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-background-http/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-calendar/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-photoviewer/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-telerik-ui/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/nativescript-web-image-cache/include.gradle
    +applying configuration from: /Users/student/Desktop/Native_Script/Library/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/android-upload-service.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/calendarpermissions-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/Common-2016.2.629-dev-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/Data-2016.2.629-dev-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/List-2016.2.629-dev-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/Primitives-2016.2.629-dev-release.aar
    +adding dependency: /Users/student/Desktop/Native_Script/Library/platforms/android/libs/aar/widgets-release.aar
Observed package id '..;..;..;var;lib;android-sdk;samples;android-22' in inconsistent location '/usr/local/Cellar/android-sdk/24.4.1_1/samples/android-22' (Expected '/usr/local/Cellar/android-sdk/24.4.1_1/../../../var/lib/android-sdk/samples/android-22')
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preF0F1F2F3F4F5DebugBuild UP-TO-DATE
:checkF0F1F2F3F4F5DebugManifest
:preF0F1F2F3F4F5ReleaseBuild UP-TO-DATE
:prepareAndroidUploadServiceLibrary UP-TO-DATE
:prepareCalendarpermissionsReleaseLibrary UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:prepareComAndroidSupportPaletteV72320Library UP-TO-DATE
:prepareComAndroidSupportRecyclerviewV72320Library UP-TO-DATE
:prepareComAndroidSupportSupportV42411Library UP-TO-DATE
:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:prepareComGithubLawloretienneImagegallery0013Library UP-TO-DATE
:prepareCommon20162629DevReleaseLibrary UP-TO-DATE
:prepareData20162629DevReleaseLibrary UP-TO-DATE
:prepareLibraryRuntimeUnspecifiedLibrary UP-TO-DATE
:prepareList20162629DevReleaseLibrary UP-TO-DATE
:preparePrimitives20162629DevReleaseLibrary UP-TO-DATE
:prepareWidgetsReleaseLibrary UP-TO-DATE
:prepareF0F1F2F3F4F5DebugDependencies
:compileF0F1F2F3F4F5DebugAidl UP-TO-DATE
:compileF0F1F2F3F4F5DebugRenderscript UP-TO-DATE
:generateF0F1F2F3F4F5DebugBuildConfig UP-TO-DATE
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:asbg:generateInterfaceNamesList
:asbg:runAstParser UP-TO-DATE
:asbg:generateBindings UP-TO-DATE
:mergeF0F1F2F3F4F5DebugShaders UP-TO-DATE
:compileF0F1F2F3F4F5DebugShaders UP-TO-DATE
:generateF0F1F2F3F4F5DebugAssets UP-TO-DATE
:mergeF0F1F2F3F4F5DebugAssets UP-TO-DATE
:generateF0F1F2F3F4F5DebugResValues UP-TO-DATE
:generateF0F1F2F3F4F5DebugResources UP-TO-DATE
:mergeF0F1F2F3F4F5DebugResources UP-TO-DATE
:processF0F1F2F3F4F5DebugManifest UP-TO-DATE
:processF0F1F2F3F4F5DebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processF0F1F2F3F4F5DebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/23.0.2/aapt'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 22.837 secs
Command /Users/student/Desktop/Native_Script/Library/platforms/android/gradlew failed with exit code 1
# build android
`
Plamen5kov commented 8 years ago

@vchittar can you run the command:

cd ./platforms/android && ./gradlew buildapk --debug

and post the result back here. Also could you post the results of the commands:

ls -la /usr/local/Cellar/android-sdk and ls -la /usr/local/Cellar/android-sdk/24.4.1_1

vekexasia commented 8 years ago

@Plamen5kov do you think mine is related?

Plamen5kov commented 8 years ago

Hi @vekexasia, I don't believe so, because Process 'command '/home/andrea/android-sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1 that means the aapt tool is found and it returns an error, while it's being used. If you want you can run the same command:

cd ./platforms/android && ./gradlew buildapk --debug

So we can figure out what's wrong. Please give a ling to paste bin.

@vekexasia what cli version are you using? You might need to update your build and platform tools from the android sdk manager.

vchittar commented 8 years ago

http://pastebin.com/edkZDR4x (This is the gradlew --debug command)

http://pastebin.com/ZQzqvciR (first ls -la command)

http://pastebin.com/eQv4MpU2 (second ls -la command)

Plamen5kov commented 8 years ago

Hi @vchittar, You need to point your $ANDROID_SDK environment variable to /usr/local/var/lib/android-sdk. The exports should look like this:

export ANDROID_HOME="/usr/local/var/lib/android-sdk"
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools

And make sure you have the correct access rights, when you try and execute a command.

EDIT: As you can see in this line from the log you sent:

4:20:53.694 [WARN] [org.gradle.api.Project] Observed package id '..;..;..;var;lib;android-sdk;samples;android-22' in inconsistent location '/usr/local/Cellar/android-sdk/24.4.1_1/samples/android-22' (Expected '/usr/local/Cellar/android-sdk/24.4.1_1/../../../var/lib/android-sdk/samples/android-22')

It complains about inconsistent location, because you need to set up the path to the anndroid sdk.

vchittar commented 8 years ago

@Plamen5kov

Hey thanks for all the help, but I checked my .profile and corrected it a little bit and I still cant run tns run android for some reason.

The error I get is : "Cannot read property 'toString' of undefined"

Thank you for being so patient with me and helping me solve my problems.

EDIT: I edited ~/.profile and ~/bash_profile so it would point to the correct Android Home directory and it still doesnt work.

Plamen5kov commented 8 years ago

@vchittar please link the whole error log.

vchittar commented 8 years ago
IDTStudentMBP:Library student$ tns run android
Cannot read property 'toString' of undefined
# run android

Thats the whole error even with the debug flag.

Plamen5kov commented 8 years ago

Could you run tns run android --log trace so we can get a bit more info. You can also run tns doctor to help with problems you might have with your environment.

vchittar commented 8 years ago
IDTStudentMBP:Library student$ tns run android --log trace
execFile: /usr/local/var/lib/android-sdk/platform-tools/adb "help"
Error while executing '/usr/local/var/lib/android-sdk/platform-tools/adb help'. Error is: spawn /usr/local/var/lib/android-sdk/platform-tools/adb ENOENT
execFile: /usr/local/var/lib/android-sdk/platform-tools/adb "help"
Error while executing '/usr/local/var/lib/android-sdk/platform-tools/adb help'. Error is: spawn /usr/local/var/lib/android-sdk/platform-tools/adb ENOENT
spawn: adb "version"
Result when throw error is false:
{ stdout: 'Android Debug Bridge version 1.0.36\nRevision af05c7354fe1-android\n',
  stderr: '',
  exitCode: 0 }
spawn: adb "--help"
Socket {
  _connecting: false,
  _hadError: false,
  _handle: 
   Pipe {
     _externalStream: {},
     fd: 19,
     writeQueueSize: 0,
     owner: [Circular],
     onread: [Function: onread],
     reading: true },
  _parent: null,
  _host: null,
  _readableState: 
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: [],
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: true,
     sync: false,
     needReadable: true,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     defaultEncoding: 'utf8',
     ranOut: false,
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  domain: null,
  _events: 
   { end: { [Function: g] listener: [Function: onend] },
     finish: [Function: onSocketFinish],
     _socketEnd: [Function: onSocketEnd],
     close: [Function] },
  _eventsCount: 4,
  _maxListeners: undefined,
  _writableState: 
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     decodeStrings: false,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree: CorkedRequest { next: [Object], entry: null, finish: [Function] } },
  writable: false,
  allowHalfOpen: false,
  destroyed: false,
  bytesRead: 0,
  _bytesDispatched: 0,
  _sockname: null,
  _writev: null,
  _pendingData: null,
  _pendingEncoding: '',
  server: null,
  _server: null }
Exec uname -a 
 stdout: Darwin IDTStudentMBP.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

 stderr: 
Exec npm -v 
 stdout: 3.10.2

 stderr: 
spawn: java "-version"
Exec node-gyp -v 
 stdout:  
 stderr: /bin/sh: node-gyp: command not found

Exec xcodebuild -version 
 stdout: Xcode 7.3.1
Build version 7D1014

 stderr: 
Exec gem which xcodeproj 
 stdout: /Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.2.0/lib/xcodeproj.rb

 stderr: 
Exec pod --version 
 stdout: 1.0.1

 stderr: 
Exec null version 
 stdout:  
 stderr: /bin/sh: null: command not found

spawn: /usr/local/var/lib/android-sdk/tools/android "-h"
Exec mono --version 
 stdout:  
 stderr: /bin/sh: mono: command not found

Exec git --version 
 stdout: git version 2.7.4

 stderr: 
Exec gradle -v 
 stdout:  
 stderr: /bin/sh: gradle: command not found

Exec "javac" -version 
 stdout:  
 stderr: javac 1.8.0_92

System information:
{ procInfo: 'nativescript/2.2.1',
  platform: 'darwin',
  os: 'Darwin IDTStudentMBP.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v4.4.1',
  npmVer: '3.10.2',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 7.3.1\nBuild version 7D1014\n',
  xcodeprojGemLocation: '/Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.2.0/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: '1.0.1',
  adbVer: null,
  androidInstalled: '',
  monoVer: null,
  gitVer: '2.7.4',
  gradleVer: null,
  javacVersion: '1.8.0_92' }
Initializing analytics statuses.
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'run'.
AnalyticsInstallationID: a5c704e4-d53f-4524-bc6e-41505e69104c
monitor not started
monitor not started
monitor not started
monitor has started, connecting to http://5752dabccfc54c4ab82aea9626b7338e.monitor-eqatec.com/json.ashx
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'NodeJSVersion' with value '4_4_1'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Looking for project in '/Users/student/Desktop/Native_Script/Library'
Project directory is '/Users/student/Desktop/Native_Script/Library'.
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'run|android'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
startLookingForDevices; platform is Android
spawn: adb "start-server"
Result when throw error is false:
{ stdout: '', stderr: '', exitCode: 0 }
spawn: adb "devices"
spawn: adb "-s" "192.168.56.101:5555" "shell" "getprop"
Result when throw error is false:
{ stdout: '[ARGH]: [ARGH]\r\n[androVM.inited]: [1]\r\n[androVM.vbox_dpi]: [640]\r\n[androVM.vbox_graph_mode]: [1440x2560-16]\r\n[dalvik.vm.dex2oat-Xms]: [64m]\r\n[dalvik.vm.dex2oat-Xmx]: [512m]\r\n[dalvik.vm.heapgrowthlimit]: [96m]\r\n[dalvik.vm.heapmaxfree]: [8m]\r\n[dalvik.vm.heapminfree]: [512k]\r\n[dalvik.vm.heapsize]: [256m]\r\n[dalvik.vm.heapstartsize]: [8m]\r\n[dalvik.vm.heaptargetutilization]: [0.75]\r\n[dalvik.vm.image-dex2oat-Xms]: [64m]\r\n[dalvik.vm.image-dex2oat-Xmx]: [64m]\r\n[dalvik.vm.isa.x86.features]: [default]\r\n[dalvik.vm.isa.x86.variant]: [x86]\r\n[dalvik.vm.lockprof.threshold]: [500]\r\n[dalvik.vm.stack-trace-file]: [/data/anr/traces.txt]\r\n[debug.atrace.tags.enableflags]: [0]\r\n[debug.force_rtl]: [0]\r\n[dev.bootcomplete]: [1]\r\n[genyd.ac.online.cached]: [0]\r\n[genyd.battery.capacity.cached]: [74]\r\n[genyd.battery.status.cached]: [Discharging]\r\n[genyd.device.id]: [000000000000000]\r\n[gsm.current.phone-type]: [1]\r\n[gsm.network.type]: [UMTS]\r\n[gsm.operator.alpha]: [Android]\r\n[gsm.operator.iso-country]: [us]\r\n[gsm.operator.isroaming]: [false]\r\n[gsm.operator.numeric]: [310260]\r\n[gsm.sim.operator.alpha]: [Android]\r\n[gsm.sim.operator.iso-country]: [us]\r\n[gsm.sim.operator.numeric]: [310260]\r\n[gsm.sim.state]: [READY]\r\n[gsm.version.ril-impl]: [android reference-ril 1.0]\r\n[init.svc.adbd]: [running]\r\n[init.svc.back_camera]: [running]\r\n[init.svc.bootanim]: [stopped]\r\n[init.svc.console]: [running]\r\n[init.svc.debuggerd]: [running]\r\n[init.svc.drm]: [running]\r\n[init.svc.front_camera]: [running]\r\n[init.svc.gatekeeperd]: [running]\r\n[init.svc.genybaseband]: [running]\r\n[init.svc.genyd]: [running]\r\n[init.svc.healthd]: [running]\r\n[init.svc.installd]: [running]\r\n[init.svc.keystore]: [running]\r\n[init.svc.lmkd]: [running]\r\n[init.svc.local_gps]: [running]\r\n[init.svc.local_opengl]: [running]\r\n[init.svc.logd]: [running]\r\n[init.svc.logd-reinit]: [stopped]\r\n[init.svc.media]: [running]\r\n[init.svc.netd]: [running]\r\n[init.svc.perfprofd]: [running]\r\n[init.svc.ril-daemon]: [running]\r\n[init.svc.servicemanager]: [running]\r\n[init.svc.su_daemon]: [stopped]\r\n[init.svc.surfaceflinger]: [running]\r\n[init.svc.ueventd]: [running]\r\n[init.svc.vbox86-setup]: [stopped]\r\n[init.svc.vinput]: [running]\r\n[init.svc.vinput_seamless]: [running]\r\n[init.svc.vold]: [running]\r\n[init.svc.wpa_supplicant]: [running]\r\n[init.svc.zygote]: [running]\r\n[keyguard.no_require_sim]: [true]\r\n[net.bt.name]: [Android]\r\n[net.change]: [net.dns3]\r\n[net.dns1]: [172.29.40.66]\r\n[net.dns2]: [172.29.40.81]\r\n[net.dns3]: [172.25.192.69]\r\n[net.eth0.dns1]: []\r\n[net.eth0.dns2]: []\r\n[net.hostname]: [android-1543709e94d837cf]\r\n[net.qtaguid_enabled]: [1]\r\n[net.tcp.default_init_rwnd]: [60]\r\n[persist.service.adb.enable]: [1]\r\n[persist.sys.dalvik.vm.lib.2]: [libart.so]\r\n[persist.sys.profiler_ms]: [0]\r\n[persist.sys.timezone]: [America/New_York]\r\n[persist.sys.usb.config]: [adb]\r\n[rild.libargs]: [-s/dev/socket/baseband_ril]\r\n[rild.libpath]: [/system/lib/libreference-ril.so]\r\n[ro.allow.mock.location]: [0]\r\n[ro.baseband]: [unknown]\r\n[ro.board.platform]: []\r\n[ro.boot.console]: [tty0]\r\n[ro.boot.hardware]: [vbox86]\r\n[ro.bootimage.build.date]: [Thu Jun 9 16:05:20 UTC 2016]\r\n[ro.bootimage.build.date.utc]: [1465488320]\r\n[ro.bootimage.build.fingerprint]: [Android/vbox86p/vbox86p:6.0/MRA58K/genymotion06091605:userdebug/test-keys]\r\n[ro.bootloader]: [unknown]\r\n[ro.bootmode]: [unknown]\r\n[ro.bq.gpu_to_cpu_unsupported]: [1]\r\n[ro.build.characteristics]: [nosdcard]\r\n[ro.build.date]: [Thu Jun  9 16:05:13 UTC 2016]\r\n[ro.build.date.utc]: [1465488313]\r\n[ro.build.description]: [vbox86p-userdebug 6.0 MRA58K eng.genymotion.20160609.160320 test-keys]\r\n[ro.build.display.id]: [vbox86p-userdebug 6.0 MRA58K eng.genymotion.20160609.160320 test-keys]\r\n[ro.build.display.id.geny-def]: [vbox86p-userdebug 6.0 MRA58K eng.genymotion.20160609.160320 test-keys]\r\n[ro.build.fingerprint]: [Android/vbox86p/vbox86p:6.0/MRA58K/genymotion06091605:userdebug/test-keys]\r\n[ro.build.flavor]: [vbox86p-userdebug]\r\n[ro.build.host]: [341fc8251a9f]\r\n[ro.build.id]: [MRA58K]\r\n[ro.build.product]: [vbox86p]\r\n[ro.build.tags]: [test-keys]\r\n[ro.build.type]: [userdebug]\r\n[ro.build.user]: [genymotion]\r\n[ro.build.version.all_codenames]: [REL]\r\n[ro.build.version.base_os]: []\r\n[ro.build.version.codename]: [REL]\r\n[ro.build.version.incremental]: [eng.genymotion.20160609.160320]\r\n[ro.build.version.preview_sdk]: [0]\r\n[ro.build.version.release]: [6.0]\r\n[ro.build.version.sdk]: [23]\r\n[ro.build.version.security_patch]: [2015-10-01]\r\n[ro.carrier]: [unknown]\r\n[ro.com.android.dataroaming]: [true]\r\n[ro.com.google.locationfeatures]: [1]\r\n[ro.config.alarm_alert]: [Alarm_Classic.ogg]\r\n[ro.config.notification_sound]: [pixiedust.ogg]\r\n[ro.config.ringtone]: [Ring_Synth_04.ogg]\r\n[ro.crypto.state]: [unencrypted]\r\n[ro.dalvik.vm.native.bridge]: [0]\r\n[ro.debuggable]: [1]\r\n[ro.genyd.caps.acc]: [on]\r\n[ro.genyd.caps.baseband]: [on]\r\n[ro.genyd.caps.bat]: [on]\r\n[ro.genyd.caps.cam]: [on]\r\n[ro.genyd.caps.did]: [on]\r\n[ro.genyd.caps.gps]: [on]\r\n[ro.genyd.caps.net]: [on]\r\n[ro.genyd.caps.rmt]: [on]\r\n[ro.genyd.caps.scr]: [on]\r\n[ro.genymotion.device.version]: [1]\r\n[ro.genymotion.platform]: [p]\r\n[ro.genymotion.player.version]: [1]\r\n[ro.genymotion.version]: [2.7.2]\r\n[ro.hardware]: [vbox86]\r\n[ro.kernel.qemu]: [1]\r\n[ro.kernel.qemu.gles]: [1]\r\n[ro.lockscreen.disable.default]: [true]\r\n[ro.manufacturer.geny-def]: [Genymotion]\r\n[ro.opengles.version]: [131072]\r\n[ro.product.board]: []\r\n[ro.product.board.geny-def]: []\r\n[ro.product.brand]: [Android]\r\n[ro.product.brand.geny-def]: [Android]\r\n[ro.product.cpu.abi]: [x86]\r\n[ro.product.cpu.abilist]: [x86]\r\n[ro.product.cpu.abilist32]: [x86]\r\n[ro.product.cpu.abilist64]: []\r\n[ro.product.device]: [vbox86p]\r\n[ro.product.device.geny-def]: [vbox86p]\r\n[ro.product.locale]: [en-US]\r\n[ro.product.manufacturer]: [Genymotion]\r\n[ro.product.model]: [Samsung Galaxy S6 - 6.0.0 - API 23 - 1440x2560]\r\n[ro.product.model.geny-def]: [Genymotion \'Phone\' version]\r\n[ro.product.name]: [vbox86p]\r\n[ro.product.name.geny-def]: [vbox86p]\r\n[ro.radio.use-ppp]: [no]\r\n[ro.revision]: [0]\r\n[ro.ril.gprsclass]: [10]\r\n[ro.ril.hsxpa]: [1]\r\n[ro.runtime.firstboot]: [1471353756586]\r\n[ro.secure]: [1]\r\n[ro.serialno]: []\r\n[ro.sf.lcd_density]: [640]\r\n[ro.wifi.channels]: []\r\n[ro.zygote]: [zygote32]\r\n[ro.zygote.disable_gl_preload]: [true]\r\n[selinux.reload_policy]: [1]\r\n[service.adb.root]: [1]\r\n[service.bootanim.exit]: [1]\r\n[sys.boot_completed]: [1]\r\n[sys.sysctl.extra_free_kbytes]: [43200]\r\n[sys.sysctl.tcp_def_init_rwnd]: [60]\r\n[sys.usb.config]: [adb]\r\n[sys.usb.state]: [adb]\r\n[vold.has_adoptable]: [0]\r\n[wifi.interface]: [eth1]\r\n[wifi.interface.mac]: [08:00:27:f6:19:a4]\r\n[wlan.driver.status]: [ok]\r\n',
  stderr: '',
  exitCode: 0 }
{ characteristics: 'nosdcard',
  date: 'Thu Jun  9 16:05:13 UTC 2016',
  'date.utc': '1465488313',
  description: 'vbox86p-userdebug 6.0 MRA58K eng.genymotion.20160609.160320 test-keys',
  'display.id': 'vbox86p-userdebug 6.0 MRA58K eng.genymotion.20160609.160320 test-keys',
  'display.id.geny-def': 'vbox86p-userdebug 6.0 MRA58K eng.genymotion.20160609.160320 test-keys',
  fingerprint: 'Android/vbox86p/vbox86p:6.0/MRA58K/genymotion06091605:userdebug/test-keys',
  flavor: 'vbox86p-userdebug',
  host: '341fc8251a9f',
  id: 'MRA58K',
  product: 'vbox86p',
  tags: 'test-keys',
  type: 'userdebug',
  user: 'genymotion',
  all_codenames: 'REL',
  base_os: '',
  codename: 'REL',
  incremental: 'eng.genymotion.20160609.160320',
  preview_sdk: '0',
  release: '6.0',
  sdk: '23',
  security_patch: '2015-10-01',
  board: '',
  'board.geny-def': '',
  brand: 'Android',
  'brand.geny-def': 'Android',
  'cpu.abi': 'x86',
  'cpu.abilist': 'x86',
  'cpu.abilist32': 'x86',
  'cpu.abilist64': '',
  device: 'vbox86p',
  'device.geny-def': 'vbox86p',
  locale: 'en-US',
  manufacturer: 'Genymotion',
  model: 'Samsung Galaxy S6 - 6.0.0 - API 23 - 1440x2560',
  'model.geny-def': 'Genymotion \'Phone\' version',
  name: 'vbox86p',
  'name.geny-def': 'vbox86p' }
{ characteristics: 'nosdcard',
  date: 'Thu Jun  9 16:05:13 UTC 2016',
  'date.utc': '1465488313',
  description: 'vbox86p-userdebug 6.0 MRA58K eng.genymotion.20160609.160320 test-keys',
  'display.id': 'vbox86p-userdebug 6.0 MRA58K eng.genymotion.20160609.160320 test-keys',
  'display.id.geny-def': 'vbox86p-userdebug 6.0 MRA58K eng.genymotion.20160609.160320 test-keys',
  fingerprint: 'Android/vbox86p/vbox86p:6.0/MRA58K/genymotion06091605:userdebug/test-keys',
  flavor: 'vbox86p-userdebug',
  host: '341fc8251a9f',
  id: 'MRA58K',
  product: 'vbox86p',
  tags: 'test-keys',
  type: 'userdebug',
  user: 'genymotion',
  all_codenames: 'REL',
  base_os: '',
  codename: 'REL',
  incremental: 'eng.genymotion.20160609.160320',
  preview_sdk: '0',
  release: '6.0',
  sdk: '23',
  security_patch: '2015-10-01',
  board: '',
  'board.geny-def': '',
  brand: 'Android',
  'brand.geny-def': 'Android',
  'cpu.abi': 'x86',
  'cpu.abilist': 'x86',
  'cpu.abilist32': 'x86',
  'cpu.abilist64': '',
  device: 'vbox86p',
  'device.geny-def': 'vbox86p',
  locale: 'en-US',
  manufacturer: 'Genymotion',
  model: 'Samsung Galaxy S6 - 6.0.0 - API 23 - 1440x2560',
  'model.geny-def': 'Genymotion \'Phone\' version',
  name: 'vbox86p',
  'name.geny-def': 'vbox86p' }
execFile: adb "devices"
execFile: adb "-s" "192.168.56.101:5555" "shell" "getprop" "ro.product.manufacturer"
{ identifier: '192.168.56.101:5555',
  displayName: 'vbox86p',
  model: 'Samsung Galaxy S6 - 6.0.0 - API 23 - 1440x2560',
  version: '6.0',
  vendor: 'Android',
  platform: 'Android',
  status: 'Connected',
  errorHelp: null,
  isTablet: false,
  type: 'Emulator' }
Found device with identifier '192.168.56.101:5555'
Hooks directories: [ '/usr/local/lib/node_modules/nativescript/lib/hooks',
  '/usr/local/lib/node_modules/nativescript/lib/common/hooks',
  '/Users/student/Desktop/Native_Script/Library/hooks' ]
BeforeHookName for command prepare is before-prepare
Existing AndroidManifest.xml is correct.
Existing AndroidManifest.xml is correct.
spawn: /usr/local/var/lib/android-sdk/tools/android "list" "targets"
Selected version is:  undefined
spawn: /usr/local/var/lib/android-sdk/tools/android "list" "targets"
Selected targetSdk is: undefined
spawn: /usr/local/var/lib/android-sdk/tools/android "list" "targets"
Selected AppCompat version is: undefined
TypeError: Cannot read property 'toString' of undefined
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:566:15)
    at /usr/local/lib/node_modules/nativescript/lib/common/errors.js:128:33
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/services/commands-service.js:84:106
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/yok.js:208:124
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/services/commands-service.js:51:55
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/errors.js:128:33
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    - - - - -
    at /usr/local/lib/node_modules/nativescript/lib/services/android-project-service.js:191:130
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:262:80
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/common/helpers.js:224:36
    at PlatformService.descriptor.value [as preparePlatformCore] (/usr/local/lib/node_modules/nativescript/lib/common/helpers.js:191:24)
    at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:193:26
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:280:50
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
    at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:380:140
    at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'help'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, help, info, init, install, livesync, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|find, plugin|install, plugin|remove, plugin|search, plugin|update, prepare, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, usage-reporting
Reading help for command 'run|android'. FileName is 'run-android.md'.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
# run android

Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track exception with message 'Cannot read property 'toString' of undefined'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000

Sorry I forgot about the log trace command.

EDIT: I put the export commands in my terminal and that doesnt seem to work and I get the type undefined error, so do i need to put the export commands in my .bash_profile or .profile or .bashrc?

Plamen5kov commented 8 years ago

It all leads to your sdk not being installed/set up properly Try doing:

which adb //should show $ANDROID_HOME/platform-tools/adb
which android  //should show $ANDROID_HOME/tools/android

If those paths are set up properly, the following commands should run: adb --help and android --help. If those commands don't work, that mean the paths are not set up correctly, and maybe the .profile is not the right place to set up the path.

vchittar commented 8 years ago

which adb results in /usr/local/bin/adb

which android results in /usr/local/bin/android

and both adb --help and android --help work.

Plamen5kov commented 8 years ago

@vchittar that's not normal installation of the android-sdk. I would suggest removing it and installing it manually. And setting up the path variables after the manual installation.

  1. Download latest-android-sdk at the bottom.
  2. Extract content to folder (e.g.): ~/tools/android-sdk
  3. Setting up the environment variables in .bashrc or .profile or whatever suits your os distribution.
export ANDROID_HOME="~/tools/android-sdk"
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
  1. Close terminal and open again
  2. Run: which android: should point to ~/tools/android-sdk/tools/android
  3. Then tns doctor should have no problems with the sdk setup.
Plamen5kov commented 8 years ago

Well no, that depends on how you installed it in the first place. If you installed it using the package manager you should use the package manager to remove it. Otherwise there might be files left behind like: /usr/local/bin/adb and /usr/local/bin/android and much more, not to mention the symlinks you currently have:

...

lrwxr-xr-x   1 student  admin    36 Oct 13  2015 add-ons -> ../../../var/lib/android-sdk/add-ons
drwxr-xr-x  25 student  admin   850 Aug 11 22:11 bin
drwxr-xr-x   3 student  admin   102 Aug 11 22:14 build-tools
drwxr-xr-x   3 student  admin   102 Oct 13  2015 etc
lrwxr-xr-x   1 student  admin    35 Oct 13  2015 extras -> ../../../var/lib/android-sdk/extras
drwxr-xr-x  14 student  admin   476 Aug 11 22:27 platform-tools
lrwxr-xr-x   1 student  admin    38 Oct 13  2015 platforms -> ../../../var/lib/android-sdk/platforms
lrwxr-xr-x   1 student  admin    36 Oct 13  2015 samples -> ../../../var/lib/android-sdk/samples
lrwxr-xr-x   1 student  admin    36 Oct 13  2015 sources -> ../../../var/lib/android-sdk/sources
lrwxr-xr-x   1 student  admin    42 Oct 13  2015 system-images -> ../../../var/lib/android-sdk/system-images
...
vchittar commented 8 years ago

echo $ANDROID_HOME gives me "~/tools/android-sdk-linux" but which android doesnt, do you know why?

EDIT: I fixed that, and now it says "adb from the Android SDK is not installed or is not configured properly"

Plamen5kov commented 8 years ago

Please follow these steps here.

EDIT: I'm closing this issue because it's related to setting up the environment, rather than a problem with the runtime itself.

jetsgit commented 7 years ago

I am getting same error as @vchittar with tns run android --emulator

Error: Cannot read property 'targetNum' of undefined

I have run tns doctor and I get Your components are up-to-date

both adb --help and android --help work.

Environment vars:

sample-Groceries git:(angular-start) echo $ANDROID_HOME $ANDROID_HOME/platform-tools $ANDROID_HOME/tools /usr/local/opt/android-sdk /usr/local/opt/android-sdk/platform-tools /usr/local/opt/android-sdk/tools

This isn't exactly what @Plamen5kov mentioned, but seems this should not be a problem if everything is being found correctly. It is where the script installed everything.

➜ sample-Groceries git:(angular-start) which android /usr/local/bin/android

➜ sample-Groceries git:(angular-start) ls -l /usr/local/bin/android lrwxr-xr-x 1 jet admin 42 Sep 5 22:38 /usr/local/bin/android -> ../Cellar/android-sdk/24.4.1_1/bin/android

The location of installation is where the script at link @Plamen5kov provided installed android-sdk.

I did notice in my installation that:

➜ sample-Groceries git:(angular-start) ls /usr/local/Cellar/android-sdk/24.4.1_1/../../../var/lib/android-sdk/samples ➜ sample-Groceries git:(angular-start)

My samples directory is empty. I have not been able to figure out how to populate with samples using the android-sdk tool. Reading online documentation showed there was a way to do that in the past, but not seeing it now.

Plamen5kov commented 7 years ago

This issue was moved to NativeScript/nativescript-cli#2034

zjorge commented 7 years ago

For those with Error: Cannot read property 'targetNum' of undefined I recommend to take a look at http://stackoverflow.com/questions/39361369/cannot-read-property-targetnum-of-undefined/39364308#39364308. This solved my problem.