Android Studio 未在“生成”文件夹下生成“映射”文件夹



我只是想尝试proguard,看看使用它后我的apk大小会减少多少.我也遵循了Android开发人员网站的所有步骤。

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

add 尝试通过将此规则添加到 ProGuard 文件来更改默认映射文件夹的路径,但不起作用。我正在使用安卓工作室来生成签名的APK。 -printmapping build/outputs/mapping/release/mapping.txt

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

安卓 { 编译Sdk版本25 构建工具版本'25.0.2' useLibrary '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"。

因此,您的代码根本没有受到保护。

你不应该有 2 个构建类型块。

最新更新