Android 下使用gradle打包发布 apk

访问量: 551

refer to:  http://stackoverflow.com/questions/18328730/how-to-create-a-release-signed-apk-file-using-gradle , http://stackoverflow.com/questions/27472282/how-to-sign-apk-on-android-studio-even-with-non-translated-strings

非常简单, 保证你的 app/build.gradle 文件有如下内容:
android {
    signingConfigs {
        //发布版的keystore
        release {
            storeFile file("../app/tulingkey.jks")
            storePassword "123477"
            keyAlias "xx"
            keyPassword "123477"
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            // 如果你的项目中对于英语I18N方面报错,就加上下面几句:
            lintOptions {
                disable 'MissingTranslation'
                checkReleaseBuilds false
                abortOnError false
            }   
        }
    }
}

然后运行:   $ gradle assembleRelease 就可以了! 

文件会出现在: app/build/outputs/apk  目录下 ,   app-Home-release-1.0.apk

订阅/RSS Feed

Subscribe

分类/category