UVCCamera icon indicating copy to clipboard operation
UVCCamera copied to clipboard

Process 'command 'D:\SDK\ndk-bundle/ndk-build.cmd'' finished with non-zero exit value 2

Open SuperDan630 opened this issue 6 years ago • 19 comments

after I click run ,logcat output this message,how can I fix it?

SuperDan630 avatar May 14 '18 06:05 SuperDan630

Hi,

I have already the same problem, after I have updated my Android Studio.

Error is shown for the modul: libuvccamera:ndkBuild

Here is the error message log of the build process:

org.gradle.process.internal.ExecException: Process 'command '/home/rwenzel/Android/Sdk/ndk-bundle/ndk-build'' finished with non-zero exit value 2
	at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:382)
	at org.gradle.process.internal.DefaultExecAction.execute(DefaultExecAction.java:31)
	at org.gradle.api.tasks.AbstractExecTask.exec(AbstractExecTask.java:54)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.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:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:745)

I guess it happen after update grade to 4.4, but I am not 100% sure.

Here my used Android Version (Linux based) Android Studio 3.1.2 Build #AI-173.4720617, built on April 13, 2018 JRE: 1.8.0_152-release-1024-b01 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.13.0-41-generic

Any Ideas what to do, to get the project running back again. Because I try to install a backup of the project and this works also not. As well the original code shows this message.

Best regards R.

ritchie-w avatar May 14 '18 16:05 ritchie-w

Try to remove previous build and rebuild project.

iskander-saitbatalov avatar May 14 '18 19:05 iskander-saitbatalov

if somebody fix this problem,tell me please

SuperDan630 avatar May 15 '18 11:05 SuperDan630

Hi,

I have the same problem. It turns out it is a problem with new NDK (17.0.4754217). With 16.1.4479499 is is working. Also with the "famous" NDK14b which is in focus of many posts here. So change to other NDK. You can download the older versions and link it in "local.properties" file of root directory.

for example, if you put NDK in your user (here change <USER>) directory

## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Mon May 07 16:47:37 CEST 2018
ndk.dir=C\:\\Users\\<USER>\\android-ndk-r14b
sdk.dir=C\:\\Users\\<USER>\\AppData\\Local\\Android\\Sdk

heinrichu avatar May 15 '18 12:05 heinrichu

Hi,

I have download the old ndk from here https://developer.android.com/ndk/downloads/older_releases I used: android-ndk-r16b-linux-x86_64.zip Unzip the file and copy the folder into

Windows C:\Users\<USER>\ Linux /home/<USERS>/Android/Sdk/

it will create folder for Windows C:\Users\<USER>\android-ndk-r16b create folder for Linux /home/<USERS>/Android/Sdk/android-ndk-r16b

Modify the local.properties.

It fix the problem for me.

Thanks to heinrichu

Best regards R.

ritchie-w avatar May 15 '18 17:05 ritchie-w

OK....i just found out the problem. NDK 17 does not support target architectures armeabi and mips anymore...as pointed out in #277
So if you want to use NDK17, remove entries in libuvccamera\src\main\jni\Application.mk Change:

APP_ABI := armeabi armeabi-v7a x86 mips

to

APP_ABI := armeabi-v7a x86

Close Android Studio. Then you need to delete the content of the lib directories in libuvccamera\src\main\libs\*\*.so. If not you get probably an additional compiler error. Open Android Studio an rebuild your project-/s. At least it works for me.

heinrichu avatar May 18 '18 13:05 heinrichu

I also have this problem. my environment:

gradle ver.:3.3 Android plugin ver.:2.3.1 Android Studio 3.1.2 Build #AI-173.4720617, built on April 14, 2018 JRE: 1.8.0_152-release-1024-b02 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0

I checked different version of NDK; 13,14,16,17 and also followed solutions mentioned here local.properties:

ndk.dir=F\:\\android-ndk-r14b
 sdk.dir=F\:\\Sdk

any help please...

m9r1a avatar May 20 '18 10:05 m9r1a

What about changing: libuvccamera\src\main\jni\Application.mk

Why dont you use the standard paths in local.properties? You installed SDK and NDK via Android Studio?

Whats the full error message?

heinrichu avatar May 22 '18 06:05 heinrichu

I used windows; but now I'm using Ubuntu and everything is ok.

m9r1a avatar May 22 '18 06:05 m9r1a

I connect camera with hub。a hub connect 10 camera,when i reboot tablet ,UsbDevice.getDeviceId() ,The deviceId is different everyTime。I hope when i reboot the tablet,i get the unique Id。what shuld i do? help me please.

xslandlr avatar Jun 27 '18 08:06 xslandlr

@heinrichu comment worked for me.

However, I used the following line instead, to target all ABIs:

APP_ABI := all

gryphon2411 avatar Mar 26 '19 08:03 gryphon2411

I also have the same problem,but my NDK verdion is android-ndk-r10e. and the bug is <org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:ndkBuild'> then I use gradle ndkBuild, <**FAILURE: Build failed with an exception.

  • Where: Build file '/home/tao/GrRxFm/build.gradle' line: 7

  • What went wrong: A problem occurred evaluating root project 'GrRxFm'.

Could not find method google() for arguments [] on repository container.

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

BUILD FAILED**>

however, when I delete

<buildscript { repositories { jcenter() maven {url 'https://maven.google.com'} // google() in build.gradle,and make build again, the error is buildscript { repositories { jcenter() maven {url 'https://maven.google.com'} // google()> the error is <org.gradle.process.internal.ExecException: Process 'command '/home/tao/Android/Sdk/ndk-bundle/ndk-build'' finished with non-zero exit value 2>

I cd into ~/Android/Sdk/ndk-bundle and ./ndk-build it says <Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-16. make: *** No rule to make target `GrAndroid.mk'. Stop.>

I try different version of gradle. and use the true path in /etc/profile .

what I want to do is to run the project from https://codeload.github.com/trondeau/GrRxFM/zip/master

leexinyi avatar Apr 01 '19 02:04 leexinyi

OK....i just found out the problem. NDK 17 does not support target architectures armeabi and mips anymore...as pointed out in #277 So if you want to use NDK17, remove entries in libuvccamera\src\main\jni\Application.mk Change:

APP_ABI := armeabi armeabi-v7a x86 mips

to

APP_ABI := armeabi-v7a x86

Close Android Studio. Then you need to delete the content of the lib directories in libuvccamera\src\main\libs\*\*.so. If not you get probably an additional compiler error. Open Android Studio an rebuild your project-/s. At least it works for me.

Worked for me.

ghost avatar May 24 '19 09:05 ghost

I fixed this problem by this document. Apparently NDK which is installed by Android Studio is not working for previous NDK codes. So I just installed an older version and manually linked it with "Open Module Settings -> SDK Location"

https://stackoverflow.com/questions/29605029/android-studio-failed-build-ndk-project-non-zero-exit-value

whitecloudy avatar Sep 30 '19 12:09 whitecloudy

I  have tried ndk11e and gradle 4.4 with 3.1.3, it works for memaybe you don't set the true ndk. and this is my  configuration

and add "exclude 'META-INF/DEPENDENCIES'" to you build.gradle  


李昕怡

北京邮电大学/本科生/信息与通信工程学院

18811371655

北京

      ------------------ Original ------------------ From: "TronQuick"; Date: 2019年12月5日(星期四) 下午2:16 To: "saki4510t/UVCCamera"; Cc: "leexinyi"; "Comment"; Subject: Re: [saki4510t/UVCCamera] Process 'command 'D:\SDK\ndk-bundle/ndk-build.cmd'' finished with non-zero exit value 2 (#358)

 

same as u , i have try all the methods from previos guys said , but them didn't work for me.help~~TAT

i m using Android Studio 3.5.2 , SDK API 28 , NDK 14(i have try ndk14/ndk16) this is my build error report: `org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run

Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':libuvccamera:ndkBuild'. ... 6 more

Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Administrator\AppData\Local\Android\Sdk\ndk14/ndk-build.cmd'' finished with non-zero exit value 2 at java.util.Optional.orElseGet(Optional.java:267) at java.util.Optional.map(Optional.java:215) ... 38 more`

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

leexinyi avatar Dec 09 '19 01:12 leexinyi

make sure that u'r using the right version of NDK , i fix it by using the ndk14_64 , gradle 3.5.0

TronQuick avatar Dec 09 '19 01:12 TronQuick

@heinrichu comment worked for me.

However, I used the following line instead, to target all ABIs:

APP_ABI := all

Thank you all. This is the final configuration that has worked for me: Application.mk: APP_ABI := all

local.properties:

ndk.dir=...\\AppData\\Local\\Android\\Sdk\\ndk\\17.2.4988734
sdk.dir=...\\AppData\\Local\\Android\\Sdk

build.gradle:

        compileSdkVersion 31
        buildToolsVersion '30.0.2'
        minSdkVersion 23
	argetSdkVersion 27

Android Studio Arctic Fox | 2020.3.1 Patch 4 Build #AI-203.7717.56.2031.7935034, built on November 21, 2021

the output aar's jni folder has the following: image

zipswich avatar Jan 15 '22 00:01 zipswich

@zipswich can you please share 64 bit version of .so files? I keep on getting build failed.

deebashd avatar Oct 12 '22 13:10 deebashd

i new a empty project and than copy the libuvccamera model file to the new project,after that config the build.gradle, it work! f37d20fd706110b524d10dd2a7a4553 b9ad321f41195ca6c5aca724f2621fc 156fb6bd0874e3c92453e283b8b33cc

Tofu404 avatar Feb 24 '23 09:02 Tofu404