Android - multiDexKeepProguard 的用途是什么?它与 gradle 中关闭的 proguardFiles 相比如何?

Android - What is the purpose of multiDexKeepProguard ? How does it compare to proguardFiles close in gradle?

我创建了一个 multidex 应用程序。但关于混淆器,我在 build.gradle 中有以下内容:

    android {
    defaultConfig {
        ...
        multiDexEnabled true
    }
    productFlavors {
        dev {
            // Enable pre-dexing to produce an APK that can be tested on
            // Android 5.0+ without the time-consuming DEX build processes.
            minSdkVersion 21
        }
        prod {
            // The actual minSdkVersion for the production version.
            minSdkVersion 14
        }
    }
    buildTypes {
        release {
            minifyEnabled true
        ***    proguardFiles getDefaultProguardFile('proguard-android.txt'),
                                                 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile 'com.android.support:multidex:1.0.1'
}

我的问题是关于 progardFiles 与使用 multiDexKeepProguard。文档指出:

File multiDexKeepProguard

带有附加 ProGuard 规则的文本文件,用于确定哪个 类 被编译到主 dex 文件中。

如果设置,则此文件中的规则将与默认规则结合使用 构建系统使用的规则。

因此,如果我不使用 multiDexKeepProguard,那么我的 类 仍会被编译,但可能不会最终出现在主 dex 文件中,对吗?我不清楚这与 proguardFiles 有何不同。

Android 文档也 references this

如果您在应用程序中启用混淆器,通常需要定义混淆器规则。 proguardFiles 旨在成为 progurard 缩小或混淆您的应用程序的说明。

multiDexKeepProguard 专门用于告诉 multidex 哪些文件在应用程序启动时很重要,因此哪些文件应该保留在主 dex 中。据我所知,它只是为了方便而使用混淆器语法。这是可选的,通常只有在运行时出现问题时才会设置。