Java Unity Android 构建错误 WIN32 异常 ZipAlign

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24501944/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 12:37:51  来源:igfitidea点击:

Unity Android Build Error WIN32 Exception ZipAlign

javaandroidsdkunity3d

提问by Barney Chambers

Every time I try to build my game for android, I get this error:

每次我尝试为 android 构建我的游戏时,我都会收到此错误:

Error building Player: Win32Exception: 
ApplicationName='.../.../.../.../adt-bundle-mac-x86_64-20140624/sdk/tools/zipalign',
CommandLine='4"/.../.../.../.../Asteroid2(2)/Temp/StagingArea/Package.apk'". 
CurrentDirectory='Temp/StagingArea'

Any ideas? I'm stumped. I've redownloaded the SDK and that didn't help.

有任何想法吗?我难住了。我重新下载了 SDK,但没有帮助。

采纳答案by OMGtechy

  1. Find your copy of the Android SDK in explorer
  2. Go to build-toolsand choose a version (e.g.build-tools\19.1.0)
  3. Copy zipalign.exe
  4. Come back out of build-tools
  5. Go into tools
  6. Paste zipalign.exe
  1. 在资源管理器中找到您的 Android SDK 副本
  2. 转到build-tools并选择一个版本(例如build-tools\19.1.0
  3. 复制 zipalign.exe
  4. 从外面回来 build-tools
  5. 进入 tools
  6. 粘贴 zipalign.exe

回答by Ciprian

You need to copy the zipalign tool from sdk/build-tools/android-{version}/ to sdk/tools/

您需要将 zipalign 工具从 sdk/build-tools/android-{version}/ 复制到 sdk/tools/

回答by druss

To fix this error:

要修复此错误:

  • Go to C:\Program Files (x86)\Android\android-sdk\build-tools\20.0.0 (you may have different version)
  • Copy zipalign.exe to C:\Program Files (x86)\Android\android-sdk\tools\ (or in your Android SDK path)
  • 转到 C:\Program Files (x86)\Android\android-sdk\build-tools\20.0.0(您可能有不同的版本)
  • 将 zipalign.exe 复制到 C:\Program Files (x86)\Android\android-sdk\tools\(或在您的 Android SDK 路径中)

Found here

这里找到

回答by Pepon

In Unity go to Edit>Preferences>External Tools> in "Android SDK Location" select the folder of android-sdk (C:\Program Files (x86)\Android\android-sdk) in my case.

在 Unity 中,转到“Android SDK 位置”中的“编辑”>“首选项”>“外部工具”> 选择 android-sdk 文件夹(C:\Program Files (x86)\Android\android-sdk)在我的情况下。

回答by ermedian

You need to copy zipalign as suggested at accepted answer; but if there are no zipalign file in related folder first you should go tools, run android and then install build-tools

您需要按照已接受的答案中的建议复制 zipalign;但是如果相关文件夹中没有 zipalign 文件首先你应该去工具,运行 android 然后安装 build-tools

回答by UncleIstvan

I fixed this simply by updating "Tools->Android SDK Build-tools" in the Android SDK Manager to the latest version.

我通过将 Android SDK 管理器中的“Tools->Android SDK Build-tools”更新到最新版本来解决这个问题。