Android Studio 未在 Build 文件夹下生成 Mapping 文件夹

Android Studio not generating Mapping folder under Build folder

我只是想试试 proguard,看看在使用 it.i 之后我的 apk 大小会减少多少,也遵循了 android 开发者网站上的所有步骤。

但是 android studio 无法生成映射文件夹,我怎么知道我的应用程序的哪个代码被混淆了。

add 尝试通过将此规则添加到 proguard 文件来更改默认映射文件夹的路径,但没有成功。 我正在使用 android studio 生成签名 apk。 -printmapping build/outputs/mapping/release/mapping.txt

 apply plugin: 'com.android.application' apply plugin:'com.google.gms.google-services'

android { 编译SDK版本25 buildToolsVersion '25.0.2' 使用库 'org.apache.http.legacy'

dexOptions {
     incremental true
     maxProcessCount 4
     javaMaxHeapSize "3g"
 }
 defaultConfig {
     applicationId "com.metronomic.materno"
     minSdkVersion 16
     targetSdkVersion 25
     multiDexEnabled true

     // Add the following two lines
     renderscriptTargetApi 18
     renderscriptSupportModeEnabled true
     ndk {
         abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
     }
 }
 lintOptions {
     abortOnError false
 }
 buildTypes {
     release {
         debuggable false>             minifyEnabled true
         proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
                 'proguard-rules.pro'
     }
 }
 buildTypes {
     debug {
         debuggable true
     }
     release {
         minifyEnabled false
         proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.txt'
     }
 }
 packagingOptions {
     exclude 'META-INF/DEPENDENCIES.txt'
     exclude 'META-INF/DEPENDENCIES'
     exclude 'META-INF/dependencies.txt'
     exclude 'META-INF/LICENSE.txt'
     exclude 'META-INF/LICENSE'
     exclude 'META-INF/license.txt'
     exclude 'META-INF/LGPL2.1'
     exclude 'META-INF/NOTICE.txt'
     exclude 'META-INF/NOTICE'
     exclude 'META-INF/notice.txt'
 }
 productFlavors {

 } }}

您有两次 'buildTypes' 块,最后一个(Android Studio 使用的块)指定 "minifyEnabled false"。

所以您的 none 代码完全受到了保护。

你不应该有 2 个 buildTypes 块。