【问题标题】:error while building apk when minifyEnabled is true当 minifyEnabled 为 true 时构建 apk 时出错
【发布时间】:2018-11-09 10:33:17
【问题描述】:

我对 proguard 有疑问。 错误是: 找不到 [com/google/android/gms/location/LocationResult](具有 1 个已知超类)和 [com/google/android/gms/location/LocationAvailability](具有 1 个已知超类)的通用超类

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"

【问题讨论】:

    标签: android-studio proguard


    【解决方案1】:

    我认为你的问题必须解决 将 android studio 更新到 3.3.1

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-03
      • 2021-12-17
      • 1970-01-01
      • 1970-01-01
      • 2016-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多