GoogleAuthUtil类上的VerifyError

时间:2014-12-24 13:56:43

标签: java android google-authentication verifyerror

有时我可以在崩溃报告服务日志中找到如下

Caused by: java.lang.VerifyError: com/google/android/gms/auth/GoogleAuthUtil
    at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(ProGuard:255)
    at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(ProGuard:279)
    at com.google.api.client.http.HttpRequest.execute(ProGuard:859)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(ProGuard:410)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(ProGuard:343)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(ProGuard:460)

来自文档

  

当VM注意到尝试加载类时抛出   没有通过课堂验证阶段。

它很少发生,主要是在root设备上。这个类打包在应用程序中,所以它很奇怪,它只能在某些设备上运行。

我认为这是因为有人试图修改应用程序(例如通过odex或dalvik-cache修补)。目前我让应用程序崩溃了,因为它是LinkageError,我认为不应该处理它。我是对的,还是可能有其他原因造成这个问题?

1 个答案:

答案 0 :(得分:1)

由于如果遇到错误的字节代码,JVM在类加载期间抛出VerifyError,则可能是任何错误都是由检测引起的。您在Android上的错误意味着您的字节码包含对Dalvik无法加载的com/google/android/gms/auth/GoogleAuthUtil的引用。如果GoogleAuthUtil中使用的方法需要比设备上的API级别更高的API级别,也可能会发生这种情况。

除此之外,很难从客户的设备中推断出更多的事实。正如您所建议的那样,可能是有人试图修改应用程序的字节码或者(如果根设备可能更有可能)API导致GoogleAuthUtil无法正常执行。

考虑到a)在大多数情况下你无法推断出根本原因b)即使不做多少工作,让应用程序崩溃完全没问题。