-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue crash on kitkat 4.4 #259
Comments
Have you set up okhttp dependency? https://developers.amplitude.com/docs/android#1-add-dependencies |
yes okhttp has been set but the problem still exist |
I see the same (or very very similar) on KitKat (4.4.4 and 4.4.2 primarily). I'm integrated through Unity, I haven't explicitly downgraded okhttp as required for kitkat, sounds like I could fix it via https://developers.amplitude.com/docs/unity#6-android-api-compatibility
|
I confirm this crash on Android 4.4 Amplitude sdk 2.31.1 Has it been fixed with the new versions or is there a workaround? |
Hi @DonMizzi it's possible this is a compatibility issue with OkHttp. OkHttp uses reflection to access some parts of the Android SDK so is strongly coupled with the version of Android. Can you please try another version of OkHttp and see if that fixes the issue? More information here: |
okhttp3 4.2.2 requires API Level 21+ https://square.github.io/okhttp/#requirements
To support older devices could be challenging ...
|
v2.24.0 switch from okhttp3 3.10 (used in v.2.23.2) to okhttp3 4.2.2 which has a requirement on API 21. okhttp3 3.12.2 has an API 9+ requirement. That is quite a change in dependencies without any notice in the release notes! @haoliu-amp, if a developer want to support API 19, then they should use Amplitude 2.23.2 and okhttp3 3.12.2? |
We now have a new Android Kotlin SDK now! Feel free to check it out and let us know if any feedback! That library is not using okhttp as part of dependency now. |
Expected Behavior
not crash and work normally like others sdk
Current Behavior
i got crash report from google console vitals here is the stacktrace
java.lang.ExceptionInInitializerError:
at okhttp3.internal.platform.Platform$Companion.findAndroidPlatform (Platform.java:219)
at okhttp3.internal.platform.Platform$Companion.findPlatform (Platform.java:212)
at okhttp3.internal.platform.Platform$Companion.access$findPlatform (Platform.java:169)
at okhttp3.internal.platform.Platform. (Platform.java:170)
at okhttp3.OkHttpClient. (OkHttpClient.java:237)
at okhttp3.OkHttpClient. (OkHttpClient.java:222)
at com.amplitude.api.AmplitudeClient$1.run (AmplitudeClient.java:266)
at android.os.Handler.handleCallback (Handler.java:733)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:146)
at android.os.HandlerThread.run (HandlerThread.java:61)
Caused by: java.lang.IllegalStateException:
at okhttp3.internal.platform.AndroidPlatform. (AndroidPlatform.java:153)
at okhttp3.internal.platform.Platform$Companion.findAndroidPlatform (Platform.java:219)
at okhttp3.internal.platform.Platform$Companion.findPlatform (Platform.java:212)
at okhttp3.internal.platform.Platform$Companion.access$findPlatform (Platform.java:169)
at okhttp3.internal.platform.Platform. (Platform.java:170)
at okhttp3.OkHttpClient. (OkHttpClient.java:237)
at okhttp3.OkHttpClient. (OkHttpClient.java:222)
at com.amplitude.api.AmplitudeClient$1.run (AmplitudeClient.java:266)
at android.os.Handler.handleCallback (Handler.java:733)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:146)
at android.os.HandlerThread.run (HandlerThread.java:61)
Possible Solutionu
I have no idea why this error happens because on SDK above 19 it works normally.
Steps to Reproduce
Environment
The text was updated successfully, but these errors were encountered: