生成与Android Studio中的亲卫队配置文件卫队、配置文件、Android、Studio

2023-09-05 07:58:09 作者:别拿你的牙签当大炮

我使用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