我想使用USB摄像头(uvc)和Android Studio(Windows).我有USB摄像头库的问题“libuvccamera”.我想知道如何解决问题或任何其他方法来获得我的应用程序中的USB摄像头的视图.让我更好地解释发生了什么:
我用CameraFi应用程序(X1 E0 F1 X)测试了USB摄像头,USB摄像头被Android系统识别(并且工作正常)。
在Android Studio中搜索使用uvc(usb)摄像头后,我看到我可以使用这个库:https://github.com/saki4510t/UVCCamera .
下载此库+示例后,我尝试使用Android Studio打开(只需打开build.gradle),代码看起来不错,但当我尝试运行usbCameraTest 0(或任何其他示例)时,***构建失败(我附上构建输出)***:
- 失败:生成失败,出现异常。*
- 出了什么问题:任务“:libuvccammer:ndkBuild”执行失败。
启动进程“command”null/ndk-build. cmd时出现问题
- 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获取完整的见解。
从https://help.gradle.org获取更多帮助
BUILD FAILED in 2s 14可操作任务:7项已执行,7项已更新
=〉如果使用--stacktrace选项运行,则得到:
失败:生成失败,出现异常。
- 出了什么问题:任务“:libuvccammer:ndkBuild”执行失败。
启动进程“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
- 在https://help.gradle.org获得更多帮助
BUILD FAILED in 2s 16可操作任务:3个已执行,13个已更新
3条答案
按热度按时间jbose2ul1#
我遇到了同样的问题。我在www.example.com文件中添加了SDK和NDK路径local.properties。这是自述说明中的第5点。
我用的是Ubuntu 16.04,windows路径不一样。希望这对你有帮助。谢谢
2izufjch2#
设置此路径
sdk.dir=/home/username/Android/Sdk ndk.dir=/home/username/Android/Sdk/ndk-bundle
取消注解
NDK_TOOLCHAIN_VERSION:= 4.9
在UVCcamera\libuvccamera\src\main\jni\Application.mk下
pwuypxnk3#
似乎是旧的,但在我的情况下,在Android Studio(Windows)上,使用released 3.3.3的构建失败,与您的错误相同。
将文件
local.properties
从到
解决了这个问题,我能够运行应用程序。
注:
1.更正路径并检查文件夹
AndroidSDK\\ndk
中的NDK版本1.您不必在
\libuvc\src\main\jni\Application.mk
中注解# NDK_TOOLCHAIN_VERSION := 4.9
,因为在此版本中它已经注解了