2017-06-16 99 views
0

我只是想嘗試使用proguard,以查看在使用it.i後,我的apk大小會減少多少,並且遵循了android開發人員網站的所有步驟。Android Studio不會在生成文件夾下生成映射文件夾

但android studio無法生成映射文件夾,我將如何知道我的應用程序的哪些代碼被混淆。

添加嘗試更改默認映射文件夾的路徑通過將此規則添加到proguard文件,但沒有奏效。 我正在使用android studio生成signed-apk。 -printmapping build/outputs/mapping/release/mapping.txt

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

的Android { compileSdkVersion 25 buildToolsVersion '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 { 

} }} 

回答

0

你有 'buildTypes' 塊兩次,最後一個(這是Android Studio使用的)指定「minifyEnabled false」。

所以你的代碼根本沒有得到任何處理。

您不應該有2個buildTypes塊。