启用proguard后释放apk无效,无法调试

时间:2015-07-28 13:44:47

标签: android eclipse proguard release

我可以在设备中安装该应用,但该应用未连接到服务器。我也无法调试发布apk。当我禁用proguard时,应用程序连接到服务器,我也可以调试版本apk。我尝试使用proguard版本4.7,4.9和5.2.1。我的Android版本是19,我的工具版本是20.我正在使用eclipse。

我已经在我之前的版本中成功地将proguard 4.9用于生产。在我之前的发布到生产之后,我对我的代码进行了两次重大更改。我升级了谷歌播放服务,并使用jarjar修剪它,我将sdk工具升级到版本21,然后由于某些问题降级到版本20。

我想知道当我启用proguard时,我可以尝试找出出了什么问题。我从LogCat中选择的相似内容如下:

07-29 14:31:05.835: W/System.err(17696): java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.reflect.Type[]   java.lang.reflect.ParameterizedType.getActualTypeArguments()' on a null object reference
07-29 14:31:05.835: W/System.err(17696):    at com.google.api.client.util.Types.java.lang.reflect.ParameterizedType getSuperParameterizedType(java.lang.reflect.Type,   java.lang.Class)(Types.java)
     boolean isAssignableToOrFrom(java.lang.Class,java.lang.Class)(Types.java)
     java.lang.Object newInstance(java.lang.Class)(Types.java)
    IllegalArgumentException handleExceptionForNewInstance(java.lang.Exception,java.lang.Class)(Types.java)
    boolean isArray(java.lang.reflect.Type)(Types.java)
    java.lang.Class getRawClass(java.lang.reflect.ParameterizedType)(Types.java)
    reflect.Type getBound(java.lang.reflect.WildcardType)(Types.java)
    resolveTypeVariable(java.util.List,java.lang.reflect.TypeVariable)(Types.java)
    Class getRawArrayComponentType(java.util.List,java.lang.reflect.Type)(Types.java)
    reflect.Type getActualParameterAtPosition(java.lang.reflect.Type,java.lang.Class,int)(Types.java)
    Iterable iterableOf(java.lang.Object)(Types.java)
    Object toArray(java.util.Collection,java.lang.Class)(Types.java)
07-29 14:31:05.836: W/System.err(17696):    at com.google.api.client.util.Types.java.lang.reflect.Type getIterableParameter(java.lang.reflect.Type)(Types.java)
07-29 14:31:05.836: W/System.err(17696):    at com.google.api.client.http.HttpHeaders.com.google.api.client.http.HttpHeaders clone()(HttpHeaders.java)
    set(java.lang.String,java.lang.Object)(HttpHeaders.java)
    setAcceptEncoding(java.lang.String)(HttpHeaders.java)
    setAuthorization(java.util.List)(HttpHeaders.java)
    setContentLength(java.lang.Long)(HttpHeaders.java)
    void addHeader(java.util.logging.Logger,java.lang.StringBuilder,java.lang.StringBuilder,com.google.api.client.http.LowLevelHttpRequest,java.lang.String,java.lang.Object,java.io.Writer)(HttpHeaders.java)
    java.lang.String toStringValue(java.lang.Object)(HttpHeaders.java)
    void serializeHeaders(com.google.api.client.http.HttpHeaders,java.lang.StringBuilder,java.lang.StringBuilder,java.util.logging.Logger,com.google.api.client.http.LowLevelHttpRequest)(HttpHeaders.java)
    serializeHeadersForMultipartRequests(com.google.api.client.http.HttpHeaders,java.lang.StringBuilder,java.util.logging.Logger,java.io.Writer)(HttpHeaders.java)
    com.google.api.client.http.HttpHeaders,java.lang.StringBuilder,java.lang.StringBuilder,java.util.logging.Logger,com.google.api.client.http.LowLevelHttpRequest,java.io.Writer)(HttpHeaders.java)
    fromHttpResponse(com.google.api.client.http.LowLevelHttpResponse,java.lang.StringBuilder)(HttpHeaders.java)
    fromHttpHeaders(com.google.api.client.http.HttpHeaders)(HttpHeaders.java)
    parseHeader(java.lang.String,java.lang.String,com.google.api.client.http.HttpHeaders$ParseHeaderState)(HttpHeaders.java)
    java.lang.Object parseValue(java.lang.reflect.Type,java.util.List,java.lang.String)(HttpHeaders.java)
07-29 14:31:05.836: W/System.err(17696):    at com.google.api.client.http.HttpHeaders.com.google.api.client.http.HttpHeaders clone()(HttpHeaders.java)
    set(java.lang.String,java.lang.Object)(HttpHeaders.java)
    setAcceptEncoding(java.lang.String)(HttpHeaders.java)
    setAuthorization(java.util.List)(HttpHeaders.java)
    setContentLength(java.lang.Long)(HttpHeaders.java)
    void addHeader(java.util.logging.Logger,java.lang.StringBuilder,java.lang.StringBuilder,com.google.api.client.http.LowLevelHttpRequest,java.lang.String,java.lang.Object,java.io.Writer)(HttpHeaders.java)
    java.lang.String toStringValue(java.lang.Object)(HttpHeaders.java)
    void serializeHeaders(com.google.api.client.http.HttpHeaders,java.lang.StringBuilder,java.lang.StringBuilder,java.util.logging.Logger,com.google.api.client.http.LowLevelHttpRequest)(HttpHeaders.java)
    serializeHeadersForMultipartRequests(com.google.api.client.http.HttpHeaders,java.lang.StringBuilder,java.util.logging.Logger,java.io.Writer)(HttpHeaders.java)
    com.google.api.client.http.HttpHeaders,java.lang.StringBuilder,java.lang.StringBuilder,java.util.logging.Logger,com.google.api.client.http.LowLevelHttpRequest,java.io.Writer)(HttpHeaders.java)
    fromHttpResponse(com.google.api.client.http.LowLevelHttpResponse,java.lang.StringBuilder)(HttpHeaders.java)
    fromHttpHeaders(com.google.api.client.http.HttpHeaders)(HttpHeaders.java)
    parseHeader(java.lang.String,java.lang.String,com.google.api.client.http.HttpHeaders$ParseHeaderState)(HttpHeaders.java)
    java.lang.Object parseValue(java.lang.reflect.Type,java.util.List,java.lang.String)(HttpHeaders.java)
07-29 14:31:05.836: W/System.err(17696):    at com.google.api.client.http.HttpResponse.void <init>(com.google.api.client.http.HttpRequest,com.google.api.client.http.       LowLevelHttpResponse)(HttpResponse.java)
07-29 14:31:05.836: W/System.err(17696):    at com.google.api.client.http.HttpRequest.com.google.api.client.http.HttpResponse execute()(HttpRequest.java)
07-29 14:31:05.836: W/System.err(17696):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.com.google.api.client.http.HttpResponse                executeUnparsed(boolean)(AbstractGoogleClientRequest.java)
07-29 14:31:05.836: W/System.err(17696):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.com.google.api.client.http.HttpResponse            executeUnparsed()(AbstractGoogleClientRequest.java)
07-29 14:31:05.836: W/System.err(17696):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.java.lang.Object execute()(    AbstractGoogleClientRequest.java)
07-29 14:31:05.836: W/System.err(17696):    

1 个答案:

答案 0 :(得分:0)

您刚刚更改的两件事之一的Proguard配置不正确。 Google Play服务详细信息为here。他们声明您需要添加以下ProGuard配置:

  

-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 *实现android.os.Parcelable {       public static final ** CREATOR; }