Dream_1018 2021-10-20 14:53 采纳率: 100%
浏览 68
已结题

Android Studio 生成apk包时报Build command failed.错误

原项目gradle版本是3.1.0,生成apk包时没任何问题,后面因需求提升到 4.2.1后,生成apk包时报下面错误
Execution failed for task ':PyGame:externalNativeBuildRelease'.

Build command failed.
Error while executing process E:\ndk\android-ndk-r17c-windows-x86_64\android-ndk-r17c\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=F:\GameComm\proj_TongC2\TongCHuaWei\PyGame\jni\Android.mk NDK_APPLICATION_MK=F:\GameComm\proj_TongC2\TongCHuaWei\PyGame\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-21 NDK_OUT=F:/GameComm/proj_TongC2/TongCHuaWei/PyGame/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=F:\GameComm\proj_TongC2\TongCHuaWei\PyGame\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=clang -j8 NDK_MODULE_PATH=F:/GameComm/proj_TongC2/cocos2d;F:/GameComm/proj_TongC2/cocos2d/cocos;F:/GameComm/proj_TongC2/cocos2d/external NDK_DEBUG=0 MyGame}

  • 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.

执行 Run with --info 后如下日志
Starting process 'command 'E:\ndk\android-ndk-r17c-windows-x86_64\android-ndk-r17c\ndk-build.cmd''. Working directory: F:\GameComm\proj_TongC2\TongCHuaWei\PyGame Command: E:\ndk\android-ndk-r17c-windows-x86_64\android-ndk-r17c\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=F:\GameComm\proj_TongC2\TongCHuaWei\PyGame\jni\Android.mk NDK_APPLICATION_MK=F:\GameComm\proj_TongC2\TongCHuaWei\PyGame\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-21 NDK_OUT=F:/GameComm/proj_TongC2/TongCHuaWei/PyGame/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=F:\GameComm\proj_TongC2\TongCHuaWei\PyGame\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=clang -j8 NDK_MODULE_PATH=F:/GameComm/proj_TongC2/cocos2d;F:/GameComm/proj_TongC2/cocos2d/cocos;F:/GameComm/proj_TongC2/cocos2d/external NDK_DEBUG=0 MyGame
Successfully started process 'command 'E:\ndk\android-ndk-r17c-windows-x86_64\android-ndk-r17c\ndk-build.cmd''
make: *** No rule to make target `MyGame'. Stop.
:PyGame:externalNativeBuildRelease (Thread[Execution worker for ':' Thread 6,5,main]) completed. Took 1.309 secs.
:PyGame:compileReleaseJavaWithJavac (Thread[Execution worker for ':' Thread 6,5,main]) started.

Execution failed for task ':PyGame:externalNativeBuildRelease'.

Build command failed.
Error while executing process E:\ndk\android-ndk-r17c-windows-x86_64\android-ndk-r17c\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=F:\GameComm\proj_TongC2\TongCHuaWei\PyGame\jni\Android.mk NDK_APPLICATION_MK=F:\GameComm\proj_TongC2\TongCHuaWei\PyGame\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-21 NDK_OUT=F:/GameComm/proj_TongC2/TongCHuaWei/PyGame/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=F:\GameComm\proj_TongC2\TongCHuaWei\PyGame\build\intermediates\ndkBuild\release\lib NDK_TOOLCHAIN_VERSION=clang -j8 NDK_MODULE_PATH=F:/GameComm/proj_TongC2/cocos2d;F:/GameComm/proj_TongC2/cocos2d/cocos;F:/GameComm/proj_TongC2/cocos2d/external NDK_DEBUG=0 MyGame}

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

6条回答 默认 最新

  • Dream_1018 2022-01-14 11:52
    关注

    最终解决方案,亲测可行。在build.gradle文件中
    修改arguments'NDK_DEBUG=0'为arguments'NDK_DEBUG=0 -o'
    修改arguments'NDK_DEBUG=1'为arguments'NDK_DEBUG=1 -o’

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

问题事件

  • 系统已结题 1月22日
  • 已采纳回答 1月14日
  • 创建了问题 10月20日

悬赏问题

  • ¥100 linux下qt运行QCefView demo报错
  • ¥15 用Matlab实现图中的光线追迹
  • ¥15 联想笔记本开机出现系统更新界面
  • ¥15 各位帮帮我 我不想重做系统
  • ¥30 微信小程序蓝牙数据透传
  • ¥15 加氢站氢负荷数据集来源
  • ¥15 umi接入sentry遇到问题
  • ¥15 HBuilderX打包H5网页,扫码模块无法使用
  • ¥15 Javascript跳转页面后,无法执行后面代码,如何解决?
  • ¥15 echarts绘制图表