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

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日

悬赏问题

  • ¥15 树莓派ubuntu使用conda就提示core dumped
  • ¥15 帮我看看这是个啥题,带解题过程和结果,条件如下FCF = 290471.33 g1 = 15% r = 8% g2 = 4% n = 5
  • ¥15 edem模拟颗粒不显示或者生成失败
  • ¥15 Python代码编写
  • ¥15 php 将rtmp协议转hls协议,无法播放
  • ¥20 python代码编写
  • ¥20 使用MPI广播数据遇到阻塞
  • ¥15 TinyMCE如何去掉自动弹出的“链接…”工具?
  • ¥15 微信支付转账凭证,如何解决
  • ¥15 在win10下使用指纹登录时,界面上的文字最后一个字产生换行现象