Android Studio、NDK - 无法 运行 应用程序
Android Studio, NDK - Cannot Run Application
我已经(最终)使用 Gradle 实验性插件通过 Android Studio 和 NDK 构建了一个测试 SDL2 应用程序。
当我尝试 运行 项目时,它不会 运行。我收到以下错误:
:app:compileDebugSources
:app:transformClassesAndResourcesWithExtractJarsForDebug UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
我的项目可以从here下载:
有人可以帮我把它送到 运行 吗?
这是堆栈跟踪:
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:packageDebug'.
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:62)
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[=13=]0(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter.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.run(DefaultGradleLauncher.java:158)
at org.gradle.internal.Factories.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:155)
at org.gradle.initialization.DefaultGradleLauncher.access0(DefaultGradleLauncher.java:36)
at org.gradle.initialization.DefaultGradleLauncher.create(DefaultGradleLauncher.java:103)
at org.gradle.initialization.DefaultGradleLauncher.create(DefaultGradleLauncher.java:97)
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:97)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:102)
at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator.run(DaemonStateCoordinator.java:246)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.tooling.BuildException: Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:248)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:98)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 70 more
Caused by: com.android.builder.packaging.PackagerException: Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
at com.android.builder.internal.packaging.Packager.addNativeLibraries(Packager.java:472)
at com.android.builder.core.AndroidBuilder.packageApk(AndroidBuilder.java:1892)
at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:221)
... 78 more
Caused by: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/armeabi/libmain.so
File 1: W:\hello-sdl-android\android-project\app\src\main\libs\armeabi\libmain.so
File 2: W:\hello-sdl-android\android-project\app\build\intermediates\transforms\RESOURCES\FULL_PROJECT\mergeJavaRes\debug
at com.android.builder.internal.packaging.Packager$DuplicateZipFilter.checkEntry(Packager.java:93)
at com.android.builder.internal.packaging.Packager$NoBinaryZipFilter.checkEntry(Packager.java:118)
at com.android.builder.internal.packaging.Packager.doAddFile(Packager.java:532)
at com.android.builder.internal.packaging.Packager.addNativeLibraries(Packager.java:468)
... 80 more
这是启用了 --debug 和 --info 的跟踪的一部分。我看不出这里怎么会有重复文件,真的需要一些指导:
09:06:03.304 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.tooling.BuildException: Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
09:06:03.304 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:248)
09:06:03.304 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:98)
09:06:03.305 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
09:06:03.305 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
09:06:03.305 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] ... 70 more
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: com.android.builder.packaging.PackagerException: Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.builder.internal.packaging.Packager.addNativeLibraries(Packager.java:472)
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.builder.core.AndroidBuilder.packageApk(AndroidBuilder.java:1892)
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:221)
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] ... 78 more
09:06:03.308 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/armeabi/libmain.so
File 1: W:\hello-sdl-android\android-project\app\src\main\libs\armeabi\libmain.so
File 2: W:\hello-sdl-android\android-project\app\build\intermediates\transforms\RESOURCES\FULL_PROJECT\mergeJavaRes\debug
我自己发现了问题。当通过命令行上的 ndk-build 将 SDL 源构建为库时,该项目之前包含 libmain.so。 android.sources 下有 2 个部分 - 一个称为 main.jni 和另一个 main.jniLibs。我删除了 main.jniLibs,现在它开始执行了。
我已经(最终)使用 Gradle 实验性插件通过 Android Studio 和 NDK 构建了一个测试 SDL2 应用程序。
当我尝试 运行 项目时,它不会 运行。我收到以下错误:
:app:compileDebugSources
:app:transformClassesAndResourcesWithExtractJarsForDebug UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
我的项目可以从here下载:
有人可以帮我把它送到 运行 吗?
这是堆栈跟踪:
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:packageDebug'.
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:62)
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[=13=]0(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter.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.run(DefaultGradleLauncher.java:158)
at org.gradle.internal.Factories.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:155)
at org.gradle.initialization.DefaultGradleLauncher.access0(DefaultGradleLauncher.java:36)
at org.gradle.initialization.DefaultGradleLauncher.create(DefaultGradleLauncher.java:103)
at org.gradle.initialization.DefaultGradleLauncher.create(DefaultGradleLauncher.java:97)
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:97)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:102)
at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator.run(DaemonStateCoordinator.java:246)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.tooling.BuildException: Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:248)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:98)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 70 more
Caused by: com.android.builder.packaging.PackagerException: Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
at com.android.builder.internal.packaging.Packager.addNativeLibraries(Packager.java:472)
at com.android.builder.core.AndroidBuilder.packageApk(AndroidBuilder.java:1892)
at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:221)
... 78 more
Caused by: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/armeabi/libmain.so
File 1: W:\hello-sdl-android\android-project\app\src\main\libs\armeabi\libmain.so
File 2: W:\hello-sdl-android\android-project\app\build\intermediates\transforms\RESOURCES\FULL_PROJECT\mergeJavaRes\debug
at com.android.builder.internal.packaging.Packager$DuplicateZipFilter.checkEntry(Packager.java:93)
at com.android.builder.internal.packaging.Packager$NoBinaryZipFilter.checkEntry(Packager.java:118)
at com.android.builder.internal.packaging.Packager.doAddFile(Packager.java:532)
at com.android.builder.internal.packaging.Packager.addNativeLibraries(Packager.java:468)
... 80 more
这是启用了 --debug 和 --info 的跟踪的一部分。我看不出这里怎么会有重复文件,真的需要一些指导:
09:06:03.304 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.tooling.BuildException: Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
09:06:03.304 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:248)
09:06:03.304 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:98)
09:06:03.305 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
09:06:03.305 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
09:06:03.305 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
09:06:03.306 [ERROR] [org.gradle.BuildExceptionReporter] ... 70 more
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: com.android.builder.packaging.PackagerException: Failed to add W:\hello-sdl-android\android-project\app\build\intermediates\binaries\debug\lib\armeabi\libmain.so
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.builder.internal.packaging.Packager.addNativeLibraries(Packager.java:472)
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.builder.core.AndroidBuilder.packageApk(AndroidBuilder.java:1892)
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:221)
09:06:03.307 [ERROR] [org.gradle.BuildExceptionReporter] ... 78 more
09:06:03.308 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/armeabi/libmain.so
File 1: W:\hello-sdl-android\android-project\app\src\main\libs\armeabi\libmain.so
File 2: W:\hello-sdl-android\android-project\app\build\intermediates\transforms\RESOURCES\FULL_PROJECT\mergeJavaRes\debug
我自己发现了问题。当通过命令行上的 ndk-build 将 SDL 源构建为库时,该项目之前包含 libmain.so。 android.sources 下有 2 个部分 - 一个称为 main.jni 和另一个 main.jniLibs。我删除了 main.jniLibs,现在它开始执行了。