0
我正在嘗試使用proguard進行已簽名的apk。發生 錯誤:使用proguard創建已簽名apk的錯誤
Warning: Exception while processing task java.io.IOException: Can not write [C: \ Android \ App \ Project \ app \ build \ intermediates \ transforms \ proguard \ release \ jars \ 3 \ 1f \ main.jar] (Can 'T read [C: \ users \ user \ .gradle \ caches \ modules-2 \ files-2.1 \ com.google.code.gson \ gson \ 2.7 \ 751f548c85fa49f330cecbb1875893f971b33c4e \ gson-2.7.jar (;;;;;; **. Class)] (Duplicate zip entry [com/google/a/a/a.class == gson-2.7.jar: com/google/gson/annotations/Expose.class]))
Error: Execution failed for task ': app: transformClassesAndResourcesWithProguardForRelease'.
Job failed, see logs for details
的proguard-rules.pro文件I配置
-keepattributes Signature
-keep class sun.misc.Unsafe { *; }
-keep class com.exp.data.** { *; }
-dontwarn com.google.common.**
-dontwarn com.google.gson.**
-dontwarn retrofit2.converter.gson.**
-dontwarn retrofit2.Platform$Java8
-dontwarn okio.**
-dontwarn org.apache.commons.io.FilenameUtils
-keep class okio.**
爲什麼能發生一個錯誤?
我使用的build.gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "ru.vintegra.sale"
minSdkVersion 21
targetSdkVersion 25
versionCode 41
versionName '1.41'
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
compile 'com.google.android.gms:play-services-location:11.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.google.android.gms:play-services-vision:11.0.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.2'
}
在我的項目只有一個文件proguard的-android.txt-2.3.3。
的build.gradle –
你不使用谷歌GSON和釋放模式,你應該把ProGuard的文件位置添加您的應用程序。 –
我需要爲此做些什麼?我應該寫什麼? – user1854307