我遇到了麻烦,而使用这个支持由谷歌在这里描述:Building C++ in Android Studio with CMake or ndk-build
我在www.example.com中构建了一个ndk项目,它可以用"ndk-build"命令成功地构建。android.mk, and it can build successfully with the 'ndk-build' command.
我还要补充一点:
externalNativeBuild{
ndkBuild{
path "src/main/jni/Android.mk"
}
}
出现问题。下面是日志:
15:05:02.630 [INFO] [org.gradle.api.Project] External native build debug: done executing ndkBuild
15:05:02.630 [INFO] [org.gradle.api.Project] External native build debug: write build output output /Users/benny/workspace/android/myproject/mymodule/externalNativeBuild/ndkBuild/debug/mips64/ndkBuild_build_output.txt
15:05:02.669 [INFO] [org.gradle.api.Project] External native build debug: parse and convert ndk-build output to build configuration JSON
15:05:10.034 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':mymodule:generateJsonModelDebug'
15:05:10.034 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :mymodule:generateJsonModelDebug FAILED
15:05:10.034 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :mymodule:generateJsonModelDebug (Thread[main,5,main]) completed. Took 25.263 secs.
15:05:10.035 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 35.685 secs, idle: 0.17 secs
15:05:10.040 [ERROR] [org.gradle.BuildExceptionReporter]
15:05:10.042 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
15:05:10.042 [ERROR] [org.gradle.BuildExceptionReporter]
15:05:10.043 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
15:05:10.043 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':mymodule:generateJsonModelDebug'.
15:05:10.043 [ERROR] [org.gradle.BuildExceptionReporter] > @/Users/benny/workspace/android/myproject/mymodule/build/intermediates/ndkBuild/debug/obj/local/mips64/objs/navi/archiver.list
15:05:10.044 [ERROR] [org.gradle.BuildExceptionReporter]
15:05:10.044 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
15:05:10.045 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':mymodule:generateJsonModelDebug'.
15:05:10.045 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
15:05:10.045 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
15:05:10.045 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
15:05:10.046 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
15:05:10.046 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
15:05:10.046 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
15:05:10.046 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
15:05:10.046 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
15:05:10.046 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
15:05:10.060 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
15:05:10.060 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
15:05:10.077 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
15:05:10.078 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
15:05:10.078 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
15:05:10.078 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
15:05:10.078 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
15:05:10.078 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
15:05:10.078 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
15:05:10.078 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
15:05:10.079 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
15:05:10.079 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
15:05:10.079 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
15:05:10.079 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
15:05:10.079 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Factories$1.create(Factories.java:22)
15:05:10.079 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
15:05:10.079 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
15:05:10.079 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
15:05:10.079 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
15:05:10.080 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
15:05:10.081 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
15:05:10.082 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
15:05:10.118 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
15:05:10.119 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:33)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.RuntimeException: @/Users/benny/workspace/android/myproject/mymodule/build/intermediates/ndkBuild/debug/obj/local/mips64/objs/navi/archiver.list
15:05:10.120 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.external.gnumake.CommandClassifier$GccArBuildTool.checkValidInput(CommandClassifier.java:92)
15:05:10.121 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.external.gnumake.CommandClassifier$GccArBuildTool.createCommand(CommandClassifier.java:127)
15:05:10.121 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.external.gnumake.CommandClassifier.classify(CommandClassifier.java:56)
15:05:10.121 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.external.gnumake.FlowAnalyzer.analyze(FlowAnalyzer.java:46)
15:05:10.121 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.external.gnumake.NativeBuildConfigValueBuilder.addCommands(NativeBuildConfigValueBuilder.java:98)
15:05:10.121 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.NdkBuildExternalNativeJsonGenerator.processBuildOutput(NdkBuildExternalNativeJsonGenerator.java:74)
15:05:10.121 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.ExternalNativeJsonGenerator.buildAndPropagateException(ExternalNativeJsonGenerator.java:246)
15:05:10.121 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.ExternalNativeJsonGenerator.build(ExternalNativeJsonGenerator.java:162)
15:05:10.121 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.ExternalNativeBuildJsonTask.build(ExternalNativeBuildJsonTask.java:39)
15:05:10.164 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
15:05:10.164 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227)
15:05:10.164 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
15:05:10.164 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
15:05:10.164 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
15:05:10.164 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
15:05:10.165 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
15:05:10.165 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
15:05:10.165 [ERROR] [org.gradle.BuildExceptionReporter] ... 60 more
15:05:10.165 [ERROR] [org.gradle.BuildExceptionReporter]
15:05:10.165 [LIFECYCLE] [org.gradle.BuildResultLogger]
15:05:10.165 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
15:05:10.165 [LIFECYCLE] [org.gradle.BuildResultLogger]
15:05:10.166 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 1 mins 12.017 secs
顺便说一句,我已经更新了我的Android工作室2.2预览4.
先谢谢你。
2条答案
按热度按时间qybjjes11#
我能够继续切换到Android NDK r12的类似问题.
如果您使用的是MacOS +自制程序,请运行“brew update && brew upgrade android-ndk”。
同时确保在local.properties中设置了“ndk.dir”。如果您的机器上安装了多个NDK,这将有所帮助。
wwtsj6pe2#
将位于jni文件夹中的www.example.com中的“APP_STL:=stlport_static”修改为“APP_STL:= c++_shared”Application.mk可以解决该问题。