Android Studio - How to ZipAlign apk

前端 未结 6 1923
逝去的感伤
逝去的感伤 2020-12-13 17:46

I have created a signed apk using Android Studio and I\'m now going to zipalign it, I have read this: http://developer.android.com/tools/help/zipalign.html but I\'m still n

6条回答
  •  暖寄归人
    2020-12-13 18:29

    For complete signing process do follow steps. (Zip align manually after build- signed apk)

    Step 0: Before sign apk add code in your app module.gradle file : set zippAlignEnable and minifyEnable true.

    buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
                //zipAlignEnabled true 
               //uncomment for automatically zip aligned by studio
            }
        }
    

    Step 1: Sign your APK, relese mode more info

    Step 2: find location : .\your sdk\build-tools\24.0.0

    Step 3: copy your .jks keystore file and signed APK then paste it here.

    Step 4: open command prompt (For windows). set path. of your location where you paste stuff.

    Step 5: type command: zipalign -f -v 4 infile.apk outfile.apk

    here infile is my signed apk and outfile is file which is uploaded on play store.

    Done...!

    If cmp will got BUILD failed.

    See here for more about error (Zipalign build failed) do following

    1) Restart and open Android Studio,

    2) close cmd, then reopen it.

    3) Now do above process.

    Edit: resources.arsc BAD-1 error found

     set classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
    

    to

    classpath 'com.android.tools.build:gradle:2.1.2'
    

    Happy Release :)

提交回复
热议问题