使用AppCenterDistribute上传APK时遇EISDIR错误,求解决方案
解决AppCenterDistribute上传APK时的EISDIR错误
这个错误EISDIR: illegal operation on a directory, read的核心原因是你给AppCenterDistribute@3任务指定的路径是目录,而非具体的APK文件,任务试图读取目录内容而非文件,因此触发了非法操作错误。
修正步骤:
- 直接在
appFile参数中指定精确的APK文件路径,而不是目录路径。比如你已经确认$(build.artifactStagingDirectory)下存在app-release.apk,那么正确的配置应该是:- task: AppCenterDistribute@3 inputs: serverEndpoint: '你的App Center服务连接' appSlug: '你的账号/你的应用' appFile: '$(build.artifactStagingDirectory)/app-release.apk' # 精确到具体文件 releaseNotesOption: 'input' releaseNotesInput: '本次构建的版本更新' destinationType: 'groups' distributionGroupId: '你的分发组ID'
常见排查点:
- 避免只填写
$(build.artifactStagingDirectory)作为appFile的值,这是目录路径,会导致任务读取目录而非文件。 - 确认文件名拼写完全正确(注意大小写,比如不要写成
App-Release.apk)。 - 如果存在多个APK文件,可使用通配符精准匹配,比如
$(build.artifactStagingDirectory)/*.apk,但优先指定具体文件名以避免歧义。
验证路径正确性:
可以在AppCenterDistribute任务前添加脚本,确认文件确实存在:
PowerShell示例:
Write-Host "检查APK路径:$(build.artifactStagingDirectory)/app-release.apk" Test-Path "$(build.artifactStagingDirectory)/app-release.apk"
Bash示例:
echo "检查APK路径:$(build.artifactStagingDirectory)/app-release.apk" ls -la $(build.artifactStagingDirectory)/app-release.apk
内容的提问来源于stack exchange,提问作者ThunderDev
相关产品推荐
相关产品推荐

