如何在Windows 8.1上zipalign apk文件

时间:2015-03-15 18:46:10

标签: android android-studio zipalign

是的,我搜索了谷歌和其他问题

我的sdk工具目录中没有看到任何zipalign等

在Windows 8.1 64位上使用最新的android studio

我也尝试了构建gradle但它在输出apk文件中也没有做任何事情

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.monstermmorpg.pokemon"
        minSdkVersion 9
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
}

那么我如何将我的输出apk压缩到谷歌商店发布

此处截图

enter image description here

1 个答案:

答案 0 :(得分:1)

您应zip alignsign APK Android Studio

经过更正后的build.gradle,您就可以投放gradlew assembleRelease

使用keystore生成Android Studio,如下所示:

http://developer.android.com/tools/publishing/app-signing.html#studio

您的build.gradle应如下所示:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "21.0.0"

    defaultConfig {
        applicationId "com.monstermmorpg.pokemon"
        minSdkVersion 9
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }

    signingConfigs { // <-- Signing Config you needed 
        release {
            storeFile file("other.keystore")
            storePassword "android"
            keyAlias "androiddebugkey"
            keyPassword "android"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release // <-- applied signing config
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
}

在此处阅读更多内容:http://tools.android.com/tech-docs/new-build-systemhttp://developer.android.com/tools/publishing/app-signing.html