zipalign: command not found

前端 未结 9 2029
Happy的楠姐
Happy的楠姐 2021-01-31 02:51

I\'m working on Ionic project now whereby I want to zipalign the android-release-unsigned.apk file. I followed this guide by Ionic.

When I run

相关标签:
9条回答
  • 2021-01-31 03:26

    To avoid specifying or navigating to your sdk/build-tools/* directories each time you intend to build release version, you can simply add the path to your environment variable.

    $ sudo nano ~/.bash_profile

    copy and paste the below:

    export PATH=${PATH}:/Library/Android/sdk/build-tools/21.1.2

    You can then save and exit:

    control + o // to save to file
    control + x // to close the file
    $ source ~/.bash_profile

    You can then run your zipalign command from your project CLI directory.

    0 讨论(0)
  • 2021-01-31 03:27

    This worked for me on Mac. Install and run Android Studio (important to start it one time). Then find zipalign:

    find ~/Library/Android/sdk/build-tools -name "zipalign"
    
    0 讨论(0)
  • 2021-01-31 03:28

    I'm running into several problems since I installed Kali from the USB live installer. I found out that I needed to add this into my sources.list file in /etc/apt folder. Just replace the content of sources.list with:

    deb http://http.kali.org/kali kali-rolling main contrib non-free
    deb-src http://http.kali.org/kali kali-rolling main contrib non-free
    deb http://old.kali.org/kali sana main non-free contrib
    deb http://ftp.de.debian.org/debian wheezy main

    0 讨论(0)
  • 2021-01-31 03:28

    You should do (align, sign, and verify)for APK. In mac, you should do the following steps:

    A - Aligning APK:

    1- you should locate zipalign your build tools inside android SDK:

    /Users/mina/Downloads/sdk/build-tools/29.0.3/zipalign
    

    2- you should locate your unsigned apk:

     /Users/mina/Desktop/apks/app_unsigned.apk
    

    3- you should run command contains:

    zipalign_path + -v -p 4 + unsigned_apk_path + output_aligned_apk_name

    /Users/mina/Downloads/sdk/build-tools/29.0.3/zipalign -v -p 4 
    /Users/mina/Desktop/apks/app-unsigned.apk app_aligned.apk
    

    4- output is Verification successful

    B - Signing APK:

    1- you should locate apksigner your build tools inside android SDK:

    /Users/mina/Downloads/sdk/build-tools/29.0.3/apksigner
    

    2- you should locate your release-Keystore in your pc:

    /Users/mina/Desktop/keys/release-Keystore.jks
    

    3- you should run command contains:

    apksigner_path + sign --ks + release-Keystore_path + --out + output_signed_apk_name + from_aligned_apk_name

    /Users/mina/Downloads/sdk/build-tools/29.0.3/apksigner sign --ks 
    /Users/mina/Desktop/keys/release-keystore.jks                                                    
     --out app_signed.apk app_aligned.apk
    

    4- enter your key store password

    C- Verifying APK:

    1- run the following command : apksigner_path + verify + app_signed.apk

    /Users/mina/Downloads/sdk/build-tools/29.0.3/apksigner verify 
    app_signed.apk
    

    Notes: you may find some warnings:

     WARNING: META-INF/.... 
    

    Here is some description about that:

    Apk Metainfo Warning

    In practice, these files are not important, they're mostly versions of libraries you depend on, so even if someone modified those, it wouldn't have any impact on your app. That's why it's only a warning: those files in your APK can be modified by someone else while still pretending that the APK is signed by you, but those files don't really matter.

    D- find your signed APK:

    /Users/mina/app_signed.apk
    
    0 讨论(0)
  • 2021-01-31 03:31

    if you are making ionic release build then you can make build.json file on your app's root folder with these information given below

    {
    "android": {
       "release": {
       "keystore": "Your keystore",
       "storePassword": "password",
       "alias": "alias name",
       "password" : "password",
       "keystoreType": ""
        }
    }  }
    

    make sure that you can place your keystore on your app's root folder or provide full path of your keystore at keystore object

    now just you can run this command as below

    ionic cordova build android --release
    

    this command automatically find your build.json and make signed release build.

    0 讨论(0)
  • 2021-01-31 03:39

    Solved!

    I copied zipalign file as Michael Said ( from my Library/Android/SDK/build-tools/28.0.3 into my Ionic project folder)

    BUT when I run

    ./zipalign -v 4 app-release-unsigned.apk botellamovil.apk
    

    I got

    ./zipalign: ERROR while loading shared libraries: libc++.so: cannot open shared object file: **No such file or directory**
    

    So, I also copied lib & lib64 files, and then it Works!!

    I hope it will be helpful :) (and sorry for my English)

    0 讨论(0)
提交回复
热议问题