cannot find zip-align when publishing app

最后都变了- 提交于 2019-11-27 02:55:00

I had the same problem. And to fix it, I copy the Zipalign file from sdk/build-tools/android-4.4W folder to sdk/tools/

Edited: Since Google updated SDK for Android, new build-tools does fix this problem. So I encouraged everyone to update to Android SDK Build-tools 20 as suggested by Pang in the post below.

I fixed it by installing Android SDK Build-tools 20:

In EclipsePull Down MenuWindowAndroid SDK Manager, check Android SDK Build-tools Rev. 20, then click the Install n package(s)… button to start installing.

It becomes usable if you install

Android SDK Build-tools Rev.20

I used the full path of zipalign. For mac, I found the executable file in Finder and clicked on it. Then, to publish my app I ran

/Users/username/development/sdk/tools/zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk

instead of

zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk

I decided to just make a video for this..I kept pasting it into tools but alas that was not working for me. I moved it to platform-tools and voila publishing right away..must restart eclipse afterwards.

Tutorial for fixing missing zipalign

On a Mac, I did the following:

  1. Find it on o/s (I had already downloaded build tools for 19 and 20)

  2. Press Ctrl-Open to allow apps from the internet

  3. Move it from sdk/build-tools/android-4.4W folder to sdk/tools/. Whew.

Mac / Linux:

This worked for me (you might want to replace 22.0.1 with version of your build tools):

Edit: ~/.bashrc

export ANDROID_HOME=~/Android/Sdk/
export ANDROID_TOOLS=~/Android/Sdk/tools/
export ANDROID_BUILD_TOOLS=~/Android/Sdk/build-tools/22.0.1/
export ANDROID_PLATFORM_TOOLS=~/Android/Sdk/platform-tools/
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS:$ANDROID_BUILD_TOOLS

And run:

source ~/.bashrc

or just close terminal and start it again.

With the SDK update to 20, version 20 of the build and platform tools and 23 of the sdk tolls, Google has moved a lot of things.

Gradle (if you are using Android Studio) however has not yet been updated to reflect those changes, as stated in other Answers copying the zipalign binary to /sdk/tools/ should do the trick for now.

UPDATE: since Android Studio 0.8.1 got released the issue seems fixed now…
you only need to update your build.gradle and it should work fine again

compileSdkVersion 20

buildToolsVersion "20.0.0"

targetSdkVersion 20

and if you use any compat or support library

compile 'com.android.support:appcompat-v7:20.+'

compile 'com.android.support:support-v4:20.+'

Check in the SDK manager, that it has installed the "build-tools". Mine in its default state, did not do this.

If you are using gradle just update ypur gradle plugin!

Change line in build.gradle from:

classpath 'com.android.tools.build:gradle:0.9.+'

to:

classpath 'com.android.tools.build:gradle:0.11.+'

It works for me.

Note that variable buildToolsVersion (for me "20.0.0") must match your version of build-tools.

Good luck :)

With Android Studio 1.0 you have to use zipAlignEnabled true

My fix worked copying zipalign.exe from sdk\build-tools\android-4.4W to sdk\platform-tools, as shown in video linked by digiboomz, and did not work copying it in sdk\tools

If zipalign command is not found from Command-Line add file path of zipalign to environmental variables. As mentioned above, it's never good to change exe file location.

For Windows users:

Add to User->PATH->"path to zipalign folder"

In my case it path was C:\adt-bundle-windows-x86_64-20140702\sdk\build-tools\android-4.4W. In that folder is zipalign.exe

This link can help you with setting path and understanding it http://www.voidspace.org.uk/python/articles/command_line.shtml#path

I use Eclipse and this broke during an update. Here's what worked for me as the answers above did not.
I checked where ant's build.xml expected to find zipalign.exe.

In: C:\Development\Android\android-sdk\tools\ant\build.xml zipalign is defined as:

<property name="zipalign" location="${android.build.tools.dir}/zipalign${exe}" />

which indicates its expected in:

C:\Development\Android\android-sdk\build-tools\18.0.1

This directory corresponds to the highest version of the 'Android SDK Build-tools' displayed as installed in the 'Android SDK Manager'. So, that's where I copied zipalign.exe (which I obtained from an Android Studio installation!) and signed apps are now automatically zipaligned again!

i solved by RUN as Administrator @ your SDK Manager.exe in directory C:\Program Files\Android SDK

after that u'll get updated build tools an any repository

Kaps

Steps to fix this,

  1. Install latest version of Android SDK Build-Tools
  2. Check if zipalign.exe is available in folder android-sdk\build-tools\ e.g. android-sdk\build-tools\21.1.0\
  3. In some older version of android you may not find zipalign.exe. Do not panic, check any other verion in which zipalign is available.
  4. Open your project.properties file and configure build-tools to point to the in which zipalign.exe is present. e.g. sdk.buildtools=21.1.0.
  5. Restart your eclipse and try exporting again. It should work.

On a mac with OSX 10.10.5,Android Studio and SDK installed the path is

/Users/mles/Library/Android/sdk/build-tools/23.0.1/zipalign

Zipalign gradle task is deprecated since Android Plugin for Gradle, Revision 2.2.0 (September 2016).

If you want to keep using it, add android.useOldPackaging=true to your gradle.properties file.

Click here for detailed explanation.

Improves build performance by adopting a new default packaging pipeline which handles zipping, signing, and zipaligning in one task. You can revert to using the older packaging tools by adding android.useOldPackaging=true to your gradle.properties file. While using the new packaging tool, the zipalignDebug task is not available. However, you can create one yourself by calling the createZipAlignTask(String taskName, File inputFile, File outputFile) method. APK signing now uses APK Signature Scheme v2 in addition to traditional JAR signing. All Android platforms accept the resulting APKs. Any modification to these APKs after signing invalidates their v2 signatures and prevents installation on a device. Blockquote

zipalign was moved to build-tools\19.1.0 and build-tools\20.0.0, I assume you should use one of them in depend of your target SDK

I fixed it by uninstalling Android SDK Platform (4.4W) and then reinstalling it. I also restarted Eclipse after the installation.

In my case SDK Build Tools 20 were already installed. I copied zipalign.exe in Tools folder but without success.

After that I noticed that I updated Eclipse without removing or renaming the old folder.

So I did:

1) Renamed old Eclipse folder 2) Restarted Eclipse

Eclipse asked to correct Android preferences because problem was Eclipse, that was still trying to use the old folder

Google fix this mistake with the build tools version: 23.0.3 Now zipalign is packaged properly, and everything works fine.

Heitor Giacomini

Normally the zipalign.exe is close of the "Android manager"(also, "Android", "Android SDK" etc), so you can search for "Android Manager" in windows search and give a righ-click above the command and open file location. You probably are in: something\ Android\android-sdk\tools. Then is just necessary return a folder and go to Android\android-sdk\build-tools\23.0.3. The zipalign is there, you maybe be not able to use it with double-click, so you have to copy all the path of the zipalign file to use in CMD, the final code that you have to input will be something like:

C:\Users\heitor\AppData\Local\Android\android-sdk\build-tools\23.0.1\zipalign.exe -v 4 android.apk android2.apk

When I was completely desperate, I did the following, that allowed me to find official zipalign.exe. The short answer is to use the link from official (but not public :-) part of of the site:

https://dl.google.com/android/repository/build-tools_r28-rc1-windows.zip

If you use this recepy after 2018, you probably need the full explanation:

  1. Open Android Studio and go

    Android Studio->Tools->Android->SDK Manager->Android SDK->SDK update site
    
  2. Write in text editor link and open it in the browser. In my case the first link worked for me:

    https://dl.google.com/android/repository/repository2-1.xml
    
  3. Look for the latest package build-tools. In my case, it was build-tools_r28-rc1-windows.zip, but you can find the latest in your time

    Ctrl+F build-tools_
    
  4. Substitute in the URL the last part with the found package name like I did:

    https://dl.google.com/android/repository/build-tools_r28-rc1-windows.zip
    
  5. Download the package, unzip it and fortunately find official file:

    zipalign.exe
    

If it helps you, your feedback is wellcome.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!