Mapbox-navigation-android: Fatal Exception: java.lang.IllegalAccessError when proguarded (R8)

Created on 2 Apr 2019  路  9Comments  路  Source: mapbox/mapbox-navigation-android

Method 'java.lang.String c.e.c.a.a()' is inaccessible to class 'c.e.b.a.a.e' (declaration of 'c.e.b.a.a.e' appears in /XXX-Fa8I9XMskRAXduIQ2mvFCg==/base.apk

Android API: 29
Mapbox Navigation SDK version: 0.33.2

Steps to trigger behavior

  1. Proguard app with R8 (1.4.77)
  2. Run a directions fetch

Expected behavior

No crash.

Actual behavior

Fatal Exception: java.lang.IllegalAccessError
Method 'java.lang.String c.e.c.a.a()' is inaccessible to class 'c.e.b.a.a.e' (declaration of 'c.e.b.a.a.e' appears in /XXX-Fa8I9XMskRAXduIQ2mvFCg==/base.apk)
com.mapbox.api.directions.v5.DirectionsResponseFactory.generateRouteOptions (DirectionsResponseFactory.java:75)
com.mapbox.api.directions.v5.DirectionsResponseFactory.a (DirectionsResponseFactory.java:28)
com.mapbox.api.directions.v5.MapboxDirections$1.onResponse (MapboxDirections.java:128)
retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run (ExecutorCallAdapterFactory.java:71)
android.os.Handler.handleCallback (Handler.java:873)
bug

Most helpful comment

Issue was confirmed as a bug in R8 shrinker and received a fix - we will need to wait till its listed in new build tools release or specify r8 version manually until then.

There is also temporary workaround including adding new proguard rule:

-keep class com.mapbox.api.directions.v5.MapboxDirections { protected <methods>; }

cc @danesfeder

All 9 comments

Thanks for the report @hrach. We will look into this and report back. From first glance, it looks like a possible issue in our upstream Java SDK. Will move the ticket there if we deem this is the case.

cc @osana

Thanks, I'm not sure it I can somehow mitigate this with additional rule, so if there is a way, I would be glad to know :)

i have the same problem

Here it is a little bit strange... when running in a device by android studio works just fine... then I generate an apk and copy to my phone and it crashes, but in a friend's pocophone it also crashes but I can see an error details.

In my phone only crashes without error message, so i can't figured out what it is the problem

This works with proguard without R8 (same rules). Is this an issue in the mapbox side or r8 itself?

Came across same problem.
This seems like a bug in R8 i did some investigation and actually ended up opening an issue on R8 tracker 馃檲 lets see what they say : https://issuetracker.google.com/issues/136195382

Until it's resolved i have reverted to using proguard

Issue was confirmed as a bug in R8 shrinker and received a fix - we will need to wait till its listed in new build tools release or specify r8 version manually until then.

There is also temporary workaround including adding new proguard rule:

-keep class com.mapbox.api.directions.v5.MapboxDirections { protected <methods>; }

cc @danesfeder

Closing. Fix is on the way and workaround is possible ^^^.

any news?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thanhnguyenduc157 picture thanhnguyenduc157  路  5Comments

Danny-James picture Danny-James  路  4Comments

diegolaballos picture diegolaballos  路  4Comments

haroonkhan9426 picture haroonkhan9426  路  8Comments

jethromay picture jethromay  路  7Comments