Android 渐变生成失败,shrinkResources=true

Android 渐变生成失败,shrinkResources=true,android,android-gradle-plugin,build.gradle,android-proguard,Android,Android Gradle Plugin,Build.gradle,Android Proguard,我无法生成shrinkResources=true的签名apk。也附上我的proguard-rules.pro。我在stackoveflow中发现了很多东西,但是没有详细的内容来完美地解决我的问题。任何特定/正确的解决方案 前卫 # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in /Users/comviva/Li

我无法生成shrinkResources=true的签名apk。也附上我的proguard-rules.pro。我在stackoveflow中发现了很多东西,但是没有详细的内容来完美地解决我的问题。任何特定/正确的解决方案

前卫

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/comviva/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

-dontobfuscate

# Guava
-dontwarn sun.misc.Unsafe


#GSON with Retrofit
-keep class com.google.gson.** { *; }
-keep public class com.google.gson.** {public private protected *;}
-keep class com.google.inject.** { *; }
-keep class org.apache.http.** { *; }
-keep class org.apache.james.mime4j.** { *; }
-keep class javax.inject.** { *; }
-keep class javax.xml.stream.** { *; }
-keep class retrofit.** { *; }
-keep class com.google.appengine.** { *; }
-keepattributes *Annotation*
-keepattributes Signature
-dontwarn com.squareup.okhttp.*
-dontwarn rx.**
-dontwarn javax.xml.stream.**
-dontwarn com.google.appengine.**
-dontwarn java.nio.file.**
-dontwarn org.codehaus.**


-dontwarn retrofit2.**
-dontwarn org.codehaus.mojo.**
-keep class retrofit2.** { *; }
-keepattributes Exceptions
-keepattributes RuntimeVisibleAnnotations
-keepattributes RuntimeInvisibleAnnotations
-keepattributes RuntimeVisibleParameterAnnotations
-keepattributes RuntimeInvisibleParameterAnnotations

#For Android Support
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.MapActivity
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider

-keepattributes EnclosingMethod
-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}
-keepclasseswithmembers interface * {
    @retrofit2.* <methods>;
}
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions

# Android Support
-keep class android.support.** { *; }

# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
-dontwarn okio.**

-keep class com.google.gson.internal.** { *; }
-keep interface com.google.gson.internal.** { *; }
# Gson's empty constructor is considered to be unused by proguard
-keepclassmembers class * extends com.google.gson.internal.ConstructorConstructor {
    <init>(...);
}
-dontwarn com.google.android.gms.internal.zzbeb
-dontwarn com.google.android.gms.internal.zzbec
-keep class com.google.android.gms.internal.** { *; }

-keep class com.google.android.gms.ads.identifier.** { *; }
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

##---------------End: proguard configuration for Gson  ----------

启用minifyEnabled以使用快照代码下方的shrinkResources

android {
buildTypes {
    release {
        shrinkResources true
        minifyEnabled true     // <---- here
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
    }
}
...
android{
建筑类型{
释放{
真的吗
minifyEnabled true//
android {
buildTypes {
    release {
        shrinkResources true
        minifyEnabled true     // <---- here
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
    }
}
...