1

Facing notorious java.lang.VerifyError. Initially problem showed up in Fabric. Was able to reproduce (with identical stacktrace) once set minifyEnabled true for debug build.

Caused by java.lang.VerifyError: Verifier rejected class com.evernote.client.conn.mobile.TEvernoteHttpClient: void com.evernote.client.conn.mobile.TEvernoteHttpClient.cancel() failed to verify: void com.evernote.client.conn.mobile.TEvernoteHttpClient.cancel(): [0x6] 'this' argument 'Reference: org.apache.http.client.methods.HttpRequestBase' not instance of 'Reference: org.apache.http.client.methods.AbstractExecutionAwareRequest'
 void com.evernote.client.conn.mobile.TEvernoteHttpClient.flush() failed to verify: void com.evernote.client.conn.mobile.TEvernoteHttpClient.flush(): [0x7F] 'this' argument 'Reference: org.apache.http.impl.client.DefaultHttpClient' not instance of 'Reference: org.apache.http.impl.client.CloseableHttpClient' (declaration of 'com.evernote.client.conn.mobile.TEvernoteHttpClient' appears in base.apk)
       at com.evernote.client.android.ClientFactory.createNoteStoreClient + 85(ClientFactory.java:85)

I see that typically java.lang.VerifyError issues are recognized as related to difference between code to compile and run against.

This is not the case since code runs just fine when minification is disabled.

The way I see this can be helped is making another rule, but I am failing to understand which classes need to be kept from this error details.

We are already doing

-keep class com.evernote.** { *; }
-keep interface com.evernote.** { *; }

-keep class org.apache.http.** { *; }
-keep interface org.apache.http.** { *; }

... and those classes don't get modified in any way. I've checked it using -printusage ./full-r8-config.txt instruction and checking the output. Classes mentioned in error details do not show up there.

UPDATE 1 day later: Really strange thing going on here. So far I have a verified backup plan: switching back to proguard fixes issue.

But in case if I want to stay with R8, here comes:

  • using -dontshrink, -dontoptimize and -dontobfuscate (all three at once) does no impact;

  • forcing specific apache.http version dependency does no impact;

  • I've checked mapping: neither Evernore SDK, nor Apache http classes don't get obfuscated;

  • issue pertains when app executed on api22 device (emulator, actually);

  • I was able to debug code once I had -dontobfuscate set. All goes well until Evernote's ClientFactory#createUserStoreClient decides to instantiate TEvernoteHttpClient - the moment program execution touches latter class's constructor - exception thrown.

It looks like it is all good to go, but this verifier fails.

Later update:

Issue filed as a bug for R8: https://issuetracker.google.com/issues/139268389. Please feel free to star it if facing similar situation (all code is in place but VerifyError is thrown)

4

1 回答 1

0

试着写下 proguard 规则。

-dontwarn com.evernote.client.conn.mobile.TAndroidTransport
-dontwarn com.evernote.client.conn.mobile.DiskBackedByteStore
-dontwarn com.evernote.client.conn.mobile.ByteStore 
-dontwarn org.apache.commons.codec.binary.Base64
于 2019-08-17T13:01:29.753 回答