Android的工作室 - 如何ZipAlign APK工作室、Android、APK、ZipAlign

由网友(孤城凉梦)分享简介:我已经采用Android Studio创建一个签名的apk,我现在要zipalign它,我已阅读本:http://developer.android.com/tools/help/zipalign.html但我仍然不知道在哪里加code线,是它在摇篮文件,并在文件中,我加入了线?I have created a...

我已经采用Android Studio创建一个签名的apk,我现在要zipalign它,我已阅读本: http://developer.android.com/tools/help/zipalign.html 但我仍然不知道在哪里加code线,是它在摇篮文件,并在文件中,我加入了线?

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 not sure where to add the lines of code, is it in the Gradle file and where in the file do I add the lines?

推荐答案

在里面你主要模块的 build.gradle 文件,你可以有多个版本的类型以及调试之一。

Inside you main module's build.gradle file you can have multiple build types along with your debug one.

您可以像

buildTypes {

     release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        zipAlignEnabled true
    }
}

注意:旧版本使用 zipAlign ,而不是 zipAlignEnabled

Note: Older versions use zipAlign, instead of zipAlignEnabled

默认摇篮任务总是调试创建,您是否定义或没有释放buildTypes。调试是为了调试和发布烧焦的应用程序的(生成>生成签名的.apk)。您必须确定您的signingConfig的发布版本。

Default gradle tasks always created for debug and release buildTypes whether you define or not. Debug is for debugging purpose and Release for Singed Application (Build > generate Signed Apk). You must define your signingConfig for release builds.

检查生成类型一节中提到下面的链接,你可以在你的buildTypes使用其他的属性。

Check Build Types section in below mentioned link for other properties that you can use in your buildTypes

http://tools.android.com/tech-docs/new-build-system/user-guide

阅读全文

相关推荐

最新文章