gradle build 时 Android 打包失败,错误为 3

Posted

技术标签:

【中文标题】gradle build 时 Android 打包失败,错误为 3【英文标题】:Android packaging failed when gradle build with error no 3 【发布时间】:2021-10-12 01:39:02 【问题描述】:

我在 UE4.26 中使用带有 firebase 插件的 jekins 尝试了 android 包。但是我的 android 打包失败,错误为 3,我尝试查找错误 3,我找不到有关错误 3 的信息,我没有解决方案。请帮帮我。

23:25:36   File ../../../Client/MyProject/Plugins/EasyFirebasePro/Source/EasyFirebase/../ThirdParty/firebase_cpp_sdk/Android/firebase_dependencies.gradle copied to C:/Jenkins/workspace/Client/MyProject/Intermediate/Android/arm64/gradle/app/firebase_dependencies.gradle
 23:25:36   Fixing minSdkVersion; NDK level above 19 requires minSdkVersion of 21 (arch=arm64)
 23:25:36   Deleting unneeded file C:\Jenkins\workspace\Client\MyProject\Intermediate\Android\arm64\gradle\permission_library\src\main\AndroidManifest.xml.
 23:25:36   
 23:25:36   Creating rungradle.bat to work around commandline length limit (using unused drive letter Z:)
 23:25:36   Making .apk with Gradle...
 23:25:37   
 23:25:37   FAILURE: Build failed with an exception.
 23:25:37   
 23:25:37   * What went wrong:
 23:25:37   Could not set process working directory to 'Z:\': could not set current directory (errno 3)
 23:25:37   
 23:25:37   * Try:
 23:25:37   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.
 23:25:37   
 23:25:37   * Get more help at https://help.gradle.org
 23:25:37   Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
 23:25:37   ERROR: cmd.exe failed with args /c "C:\Jenkins\workspace\Client\MyProject\Intermediate\Android\arm64\gradle\rungradle.bat" :app:assembleDebug
 23:25:37 Took 6.7540497s to run UnrealBuildTool.exe, ExitCode=6
 23:25:37 UnrealBuildTool failed. See log for more details. (C:\Jenkins\workspace\UnrealEngine\Engine\Programs\AutomationTool\Saved\Logs\UBT-.txt)
 23:25:37 AutomationTool exiting with ExitCode=6 (6)
 23:25:37 BUILD FAILED

【问题讨论】:

主要错误是Could not set process working directory to 'Z:\': could not set current directory (errno 3) - 所以问题是你的驱动器 `Z:` 有什么问题,为什么要让 gradle 使用它? 我对 gradle 的了解不够。 Z驱动器是我打包andorid构建时的默认路径。那不是我的意思。但通常 Z 驱动器运行良好@Robert 【参考方案1】:

您需要前往您的 build.gradle 文件(应用程序)并将您的 minSdkVersion 更改为 21。

编码愉快! :)

【讨论】:

以上是关于gradle build 时 Android 打包失败,错误为 3的主要内容,如果未能解决你的问题,请参考以下文章

Android Studio build.gradle详解

Android Studio + gradle多渠道打包

ionic3打包出错ionic cordova build android(系列一):could not find an installed version of gradle either in a

Android将library项目打包成jar文件

使用ionic cordova build android --release --prod命令打包报错解决方法

Unity打包报错A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFa