生成与Android Studio中的亲卫队配置文件 [英] Generating a Pro Guard configuration file with Android Studio

查看:192
本文介绍了生成与Android Studio中的亲卫队配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Android的工作室,因为0.1.0 ...我只是昨日获悉亲卫队似乎被集成在新创建的项目。不幸的是,这是不是真的为我的项目(​​这是前Eclipse项目)。我不知道亲卫队,直到我开始与Android的工作室工作。现在我正在寻找关于如何使用亲卫队与Android Studio范例。不幸的是,Android开发文档只提在已创建配置文件的情况。是否有可能得到的Andr​​oid Studio来创建一个配置文件到一个已经存在的项目?

I am using Android Studio since 0.1.0 ... I just learned yesterday that Pro Guard seems to be integrated in newly created projects. Unfortunately this is not true for my project (which was a former Eclipse project). I didn't know of Pro Guard until I started working with Android Studio. And now I am looking for examples on how to use Pro Guard with Android Studio. Unfortunately the Android Dev documentation is only mentioning situations where the configuration file is already created. Is there a possibility to get Android Studio to create a configuration file to an already existing project?

推荐答案

我也无法通过Android的工作室去做。然而,这为我工作。

I was also not able to do it through Android Studio. However, this worked for me.

添加以下部分,您build.gradle文件的机器人部分,填写自己的实现细节的地方为宜。

Add the following sections to the "android" section of your build.gradle file, filling in your own implementation details where appropriate.

android {

...

    signingConfigs {
        releaseConfig {
            storeFile file("/dir/to/your.keystore")
            storePassword "xxx"
            keyAlias "yyy"
            keyPassword "xxx"
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), '../your_proguard_file.txt'
            signingConfig signingConfigs.releaseConfig
        }
    }
}

在项目文件夹,运行的 ./ gradlew干净 ./ gradlew assembleRelease

In your project folder, run ./gradlew clean and ./gradlew assembleRelease

这篇关于生成与Android Studio中的亲卫队配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆