当minifyEnabled为true时生成apk时出错

时间:2018-11-09 10:33:17

标签: android-studio proguard

我对proguard有问题。 错误是: 找不到[com / google / android / gms / location / LocationResult](具有1个已知的超类)和[com / google / android / gms / location / LocationAvailability](具有1个已知的超类)的常见超类< / p>

proguard-rules.pro的代码:

-keep class com.name.ee.model.** { *; }
-keep class com.name.ee.response.** { *; }

#--------- Glide

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {

  **[] $VALUES;
  public *;}

#--------- OkHttp
-dontwarn okio.**
-dontwarn okhttp3.**

#--------- Calligraphy
-keep class uk.co.chrisjenx.calligraphy.* { *; }
-keep class uk.co.chrisjenx.calligraphy.*$* { *; }

#--------- DBflow
-keep class * extends com.raizlabs.android.dbflow.config.DatabaseHolder { *; }
-keep class com.raizlabs.android.dbflow.config.GeneratedDatabaseHolder
-keep class * extends com.raizlabs.android.dbflow.config.BaseDatabaseDefinition { *; }

#--------- Retrofit

-dontnote retrofit2.Platform
-dontwarn retrofit2.Platform$Java8
-keepattributes Signature
-keepattributes Exceptions

#--------- GSON
-keepattributes Signature
-keep class sun.misc.Unsafe { *; }
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

#-dontwarn android.support.v4.**
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**


-ignorewarnings

-keep class * {public private *;}

,实现为:

//noinspection GradleCompatible
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation "com.google.android.gms:play-services-gcm:16.0.0"

1 个答案:

答案 0 :(得分:1)

我认为您的问题必须解决 将 android studio升级到3.3.1