UVCCamera with samples, how import to android studio?
Asked Answered
A

3

8

I want work with usb camera (uvc) and Android Studio (Windows). I am having problems with the USB cam library "libuvccamera". I want to know how solve the problems or any another way to get the view of the usb cam in my app. Let me explain better what´s happening:

I tested the USB cam with CameraFi app ( https://www.camerafi.com/apps/ )and the usb camera is recognized by the Android system (and working ok).

After do a search to work with uvc (usb) cams in Android Studio, I see that I can use this library: https://github.com/saki4510t/UVCCamera.

After downloading this library + examples, I tried opening with Android Studio (simply by opening builg.gradle), the code looks ok but when I try run usbCameraTest0 (or any other example), the build failed with (I attach the build output):

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':libuvccamera:ndkBuild'.

    A problem occurred starting process 'command 'null/ndk-build.cmd''

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

    Get more help at https://help.gradle.org

BUILD FAILED in 2s 14 actionable tasks: 7 executed, 7 up-to-date

=> If run with --stacktrace option I get:

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':libuvccamera:ndkBuild'.

    A problem occurred starting process 'command 'null/ndk-build.cmd''

Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':libuvccamera:ndkBuild'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163) at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108) at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67) at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94) at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406) at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52) at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'null/ndk-build.cmd'' at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:237) at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:214) at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:364) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:87) at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42) ... 3 more Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'null/ndk-build.cmd' at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27) at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22) at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36) at org.gradle.process.internal.ExecHandleRunner.startProcess(ExecHandleRunner.java:98) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:71) ... 4 more Caused by: java.io.IOException: Cannot run program "null/ndk-build.cmd" (in directory "C:\Proyectos_STUDIO\UVCCamera-master\libuvccamera"): CreateProcess error=2, El sistema no puede encontrar el archivo especificado at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25) ... 8 more Caused by: java.io.IOException: CreateProcess error=2, El sistema no puede encontrar el archivo especificado ... 9 more

BUILD FAILED in 2s 16 actionable tasks: 3 executed, 13 up-to-date

Ascent answered 15/4, 2020 at 0:29 Comment(0)
Z
0

I had the same issue. I added the SDK and NDK path in the local.properties file. It is point 5 in the readme instructions.

sdk.dir=/home/username/Android/Sdk
ndk.dir=/home/username/Android/Sdk/ndk-bundle

I am using Ubuntu 16.04, windows path is different. Hope this helps. Thanks

Zane answered 12/8, 2020 at 11:1 Comment(2)
This solution is not working . Please suggest to me another solutionHyo
A problem occurred starting process 'command 'null/ndk-build.cmd'' at This is telling me the NDK path is not setZane
W
0

set this path

sdk.dir=/home/username/Android/Sdk ndk.dir=/home/username/Android/Sdk/ndk-bundle

uncomment

NDK_TOOLCHAIN_VERSION := 4.9

under UVCCamera\libuvccamera\src\main\jni\Application.mk

Warwickshire answered 28/3, 2022 at 20:28 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Chubby
A
0

Seem to be old but in my case on Android Studio (Windows), using released 3.3.3 the build gets failed with the same error as yours.

After changing the file local.properties from

    # header note.
    #Fri Mar 31 14:42:53 HOVT 2023
    sdk.dir=D\:\\Programs\\AndroidSDK

to

    # header note.
    #Fri Mar 31 14:42:53 HOVT 2023
    sdk.dir=D\:\\Programs\\AndroidSDK
    ndk.dir=D\:\\Programs\\AndroidSDK\\ndk\\21.4.7075529

fix the problem and I was able to run the app.

Note:

  1. Correct the path and check the NDK version you have in the folder AndroidSDK\\ndk

  2. You don't have to comment # NDK_TOOLCHAIN_VERSION := 4.9 in \libuvc\src\main\jni\Application.mk because in this version it already commented

Auliffe answered 31/3, 2023 at 16:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.