You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test the app again: flutter run --release -d <ANDROID_DEVICE_ID_HERE>
and it works as intended.
Keep all OkHttp classes
+ -keep class okhttp3.** { *; }+ -dontwarn okhttp3.**
Propused fix
Add android/proguard.txt file keep the Okhttp classes that are declared in jnigen.yaml. flutter_plugin_android_lifecycle plugin (from flutter/packages) follows a similar pattern.
This way the consumers of ok_http will not need to modify their Android platform runner files, and only the necessary classes were kept without disabling minification or including all OkHttp classes.
Proguard/R8 is removing OkHttp classes when running the Android app in release mode:
java.lang.ClassNotFoundException: Didn't find class "okhttp3/OkHttpClient$Builder" on path: DexPathList[[zip fileCausing the app to crash.
Steps to reproduce:
ok_httpdepednency, createOkHttpClientand consume itflutter run --release -d <ANDROID_DEVICE_ID_HERE>Workarounds
Warning
These workarounds should be avoided in production.
Disabling R8 / minification fully
// android/app/build.gradle.kts buildTypes { release { + isMinifyEnabled = false + isShrinkResources = false } } }Test the app again:
flutter run --release -d <ANDROID_DEVICE_ID_HERE>and it works as intended.
Keep all OkHttp classes
Propused fix
Add
android/proguard.txtfile keep the Okhttp classes that are declared injnigen.yaml.flutter_plugin_android_lifecycleplugin (fromflutter/packages) follows a similar pattern.This way the consumers of
ok_httpwill not need to modify their Android platform runner files, and only the necessary classes were kept without disabling minification or including all OkHttp classes.