启用minifyEnabled true后,登录google for android在版本apk中不起作用

启用minifyEnabled true后,登录google for android在版本apk中不起作用,android,proguard,Android,Proguard,我做了一整天的研究。由于发布了SHA1,大多数人都面临这个问题,但我已经使用了所有方法(命令行和Android studio)进行了检查。我得到的是相同的发行版哈希键,如果我在发行版构建中将minifyEnabled设置为false,它就会工作 如果我将minifyEnabled设置为true以混淆文件,则google登录不起作用 这是我的proguard文件 -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpublic

我做了一整天的研究。由于发布了SHA1,大多数人都面临这个问题,但我已经使用了所有方法(命令行和Android studio)进行了检查。我得到的是相同的发行版哈希键,如果我在发行版构建中将minifyEnabled设置为false,它就会工作

如果我将minifyEnabled设置为true以混淆文件,则google登录不起作用

这是我的proguard文件

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

# -keep public class * extends android.app.Activity
# -keep public class * extends android.app.Application
# -keep public class * extends android.app.Service
# -keep public class * extends android.content.BroadcastReceiver
# -keep public class * extends android.content.ContentProvider
# -keep public class * extends android.app.backup.BackupAgentHelper
# -keep public class * extends android.preference.Preference
# -keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *

-keepclassmembernames class *
{
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}

-dontwarn com.google.android.gms.**
-keepattributes SourceFile,LineNumberTable

-adaptresourcefilenames

-adaptresourcefilecontents

-keepdirectories

#-keepclassmembers class * {
#  public void *(android.view.View);
#}

# 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 *;
#}
-keep public class com.google.android.gms.ads.** {
   public *;
}

-keep public class com.google.ads.** {
   public *;
}

-dontwarn java.lang.invoke.*
-dontwarn **$$Lambda$*

# 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 org.xmlpull.v1.**
-dontwarn okhttp3.**
-keep class okhttp3.** { *; }
-dontwarn okio.**
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
-dontwarn javax.annotation.**

-keepclassmembers class * {
  @com.google.api.client.util.Key <fields>;
}

-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
-keep class com.google.** {*;}

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

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}
-优化过程5
-dontusemixedcaseclassnames
-DontskipnonPublicLibraryClass
-不要翻转
-冗长的
-优化!代码/简化/算术,!字段/*,!类/合并/*
#-保持公共类*扩展android.app.Activity
#-保持公共类*扩展android.app.Application
#-保持公共类*扩展android.app.Service
#-保持公共类*扩展android.content.BroadcastReceiver
#-keep public class*扩展了android.content.ContentProvider
#-keep public class*扩展了android.app.backup.BackupAgentHelper
#-保留公共类*扩展android.preference.preference
#-保留公共类com.android.vending.licensing.ILicensingService
-KeepClassSwithMemberNames类*{
本地人;
}
-keepclassswithmembers类*{
public(android.content.Context、android.util.AttributeSet);
}
-keepclassswithmembers类*{
public(android.content.Context,android.util.AttributeSet,int);
}
-keepclassmembers类*扩展了android.app.Activity{
public void*(android.view.view);
}
-keepclassmembers枚举*{
公共静态**[]值();
公共静态**valueOf(java.lang.String);
}
-keep class*实现android.os.Parcelable{
公开静态最终android.os.Parcelable$Creator*;
}
-keep class*扩展了java.util.ListResourceBundle{
受保护对象[][]getContents();
}
-保持公共类com.google.android.gms.common.internal.safeparcel.SafeParcelable{
公共静态最终***空;
}
-keepnames@com.google.android.gms.common.annotation.KeepName类*
-keepclassmembernames类*
{
@com.google.android.gms.common.annotation.KeepName*;
}
-keepnames类*实现android.os.Parcelable{
公共静态最终**创建者;
}
-保持类com.google.android.gms.common.GooglePlayServicesUtil{*;}
-dontwarn com.google.android.gms**
-keepattributes源文件,LineNumberTable
-自适应资源文件名
-AdapterResourceFileContents
-保留董事
#-keepclassmembers类*{
#public void*(android.view.view);
#}
#如果您的项目使用带JS的WebView,请取消注释以下内容
#并为JavaScript接口指定完全限定的类名
#类别:
#-keepclassmembers类fqcn.of.javascript.interface.for.webview{
#公众*;
#}
-保持公共类com.google.android.gms.ads.*{
公众*;
}
-保持公共类com.google.ads.*{
公众*;
}
-dontwarn java.lang.invoke*
-dontwarn**$$Lambda$*
#平台对Android上不存在的类型调用Class.forName以确定平台。
-dontnote 2.站台
#在Java 8虚拟机上运行时使用的平台。将不会在运行时使用。
-dontwarn 2.Platform$Java8
#保留泛型类型信息以供转换器和适配器反射使用。
-保留署名
#保留声明的已检查异常以供代理实例使用。
-保留特例
-dontwarn org.xmlpull.v1**
-dontwarn okhttp3**
-保持类okhttp3.*{*;}
-唐特沃恩·奥基奥**
-dontwarn javax.annotation.Nullable
-默认情况下,dontwarn javax.annotation.ParametersAreNonnull
-dontwarn javax.annotation**
-keepclassmembers类*{
@com.google.api.client.util.Key;
}
-KeepAttribute签名、运行时VisibleAnnotations、AnnotationDefault
-保持类com.google.*{*;}
-保持类com.google.android.gms.*{*;}
-dontwarn com.google.android.gms**
-keep class*扩展了java.util.ListResourceBundle{
受保护对象[][]getContents();
}
-保持公共类com.google.android.gms.common.internal.safeparcel.SafeParcelable{
公共静态最终***空;
}
-keepnames@com.google.android.gms.common.annotation.KeepName类*
-keepclassmembernames类*{
@com.google.android.gms.common.annotation.KeepName*;
}
-keepnames类*实现android.os.Parcelable{
公共静态最终**创建者;
}

非常感谢您的帮助,我们花了一整天的时间在这个问题上

经过两天的努力,我终于解决了这个问题。问题在于改装和车型类别

我们不应该允许重命名这样保存的模型类

-dontwarn okio.**
-dontwarn java.lang.invoke.*
-dontwarn retrofit2.Platform$Java8
-keep class retrofit.** { *; }
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * {
    @retrofit.http.* <methods>;
}
-keepclasseswithmembers interface * {
    @retrofit.http.* <methods>;
}
-keepclasseswithmembers interface * {
    @retrofit2.* <methods>;
}

-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }
-keep class javax.inject.** { *; }
 -keep class com.yourproject.YourClass**
 -keepclassmembers class com.yourproject.YourClass** {
    *;
 }
-dontwarn okio**
-dontwarn java.lang.invoke*
-dontwarn 2.Platform$Java8
-保持类更新。**{*;}
-保持类2.*{*;}
-保留署名
-保留特例
-keepclassswithmembers类*{
@http.*;
}
-KeepClassSwithMembers接口*{
@http.*;
}
-KeepClassSwithMembers接口*{
@改装2.*;
}
-保持类com.google.gson.*{*;}
-保持类com.google.inject.*{*;}
-保持类javax.inject.*{*;}
-保持类com.yourproject.YourClass**
-keepclassmembers类com.yourproject.YourClass**{
*;
}

定义“不工作”。撞车?如果是这样,崩溃后的logIt没有崩溃,我无法登录google。为什么-1,我尝试了人们在其他问题上建议的所有方法,我的问题是不同的。如果你知道答案,请提供链接。