Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[Android] internal api from okHttp being used toHumanReadableAscii #11325

Closed
kaushikgopal opened this issue Feb 26, 2018 · 5 comments
Closed
Assignees
Labels
Android Mapbox Maps SDK for Android

Comments

@kaushikgopal
Copy link

I think the telemetry initialization uses an internal method from okhttp (which has now been removed)

Platform: Android
Mapbox SDK version: 5.4.1

Steps to trigger behavior

  1. force use of okhttp 3.10.0
  2. use mapbox 5.4.1
  3. app crashes on launch initialization
    Mapbox.getInstance(this, "myMapboxToken");
    MapboxTelemetry.getInstance().setTelemetryEnabled(false);

    java.lang.NoSuchMethodError: No static method toHumanReadableAscii(Ljava/lang/String;)Ljava/lang/String; in class Lokhttp3/internal/Util; or its super classes (declaration of 'okhttp3.internal.Util' appears in /data/app/-1/base.apk:classes8.dex)
        at com.mapbox.services.android.telemetry.MapboxTelemetry.setUserAgent(MapboxTelemetry.java:315)
        at com.mapbox.services.android.telemetry.MapboxTelemetry.initialize(MapboxTelemetry.java:174)
        at com.mapbox.services.android.telemetry.MapboxTelemetry.initialize(MapboxTelemetry.java:125)
        at com.mapbox.mapboxsdk.Mapbox.getInstance(Mapbox.java:60)
        at com.company.MyApplication.onCreate(MyApplication.java:125)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
        at android.app.ActivityThread.-wrap2(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

It is also a little odd also that this Telemetry initialization takes place even before we get a chance to mark the telemetry as disabled.

I think a strategy might be to copy the Business Logic from okhttp and have it be part of mapbox vs using an internal library method (?)

@tobrun
Copy link
Member

tobrun commented Feb 27, 2018

@kaushikgopal thank you for flagging this, sad to see that we are using an internal API. I will make sure we update to the latest OkHttp version before next release. To make this happen I followed with tickets in mapbox/mapbox-events-android#69 for our new telemetry implementation (v6.0.0) and mapbox/mapbox-java#726 for our old implementation (v5.5.0, eta this or next week).

@Guardiola31337
Copy link
Contributor

Guardiola31337 commented Feb 27, 2018

Noting here that Util.toHumanReadableAscii is also used in gl-native 👀 HTTPRequest#getUserAgent()

cc @tobrun

@tobrun
Copy link
Member

tobrun commented Feb 27, 2018

To close this issue, we need to do the following on release-agua:

  • bump telemetry dependency of the 2.x series
  • bump okhttp dependency to 3.10.0
  • move Util.toHumanReadableAscii to telemetry utils version of that method

@cammace will be running point on fixing this.

@cammace
Copy link
Contributor

cammace commented Feb 27, 2018

I've opened #11338 to update the telem library to 2.2.10.

@tobrun
Copy link
Member

tobrun commented Mar 1, 2018

#11338 has been merged, aiming to release 5.5.0 today, @kaushikgopal feel free to retest once that lands. Thank you for reaching out. Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

4 participants