-
Notifications
You must be signed in to change notification settings - Fork 168
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
Compatibility issues in latest version (from v2.0.3 to v2.0.6) #74
Comments
The problems do exist. OKHttpUrlConnection was introduced to implement log interception for Android's UrlConnection, but the library has been abandoned for a long time. The related APIs have been severely disconnected with the update of OKHttp, it is really incompatible, and the issue caused is greater than Proceeds, so I decided to remove it from Pandora. This change became effective in version 2.1.0 After that, pandora no longer depends on the specific version number of OKHttp, and is fully compatible. |
It sound like the right approach. Cheers! I think you also introduced Java 8 requirement around the same time. Just in case you add it for OKHttpUrlConnection and you find it easy to remove to support more legacy apps. |
First of all, congratulation for your new plugin, it works like a charm and I love it. I didn't know about this kind of build time injection/reflection and I will definitively investigate your implementation to learn from it. Thanks! I have tested v2.1.0 and I can confirm that Android R problem is fixed. Api<21 problem still the same as it's a requirement of OkHttp 4 which still in use. It's a runtime exception on okHttp initialisation and it happen even if you don't have Pandora plugin installed or even if the host app don't use okHttp/retrofit. Easier fix will be changing |
Thanks! As the OkHttp's README says:
For
the APIs Pandora used are included in every OkHttp version. That is, Pandora is independent of the specific version of OkHttp. |
Thank you, this solve completely this issue for me. In order to help others wanting to support API<21 in modern projects, the higher valid versions are:
|
Yes, I can confirm it now, Pandora works again in Java 7 projects when excluding OkHttp 4.x and replacing it by 3.12.10, as Java 8+ requirement came from OkHttp 4.x. Nice one! My previous comment has wrong info and I will edit it. I was having issues because pandora-noop has okhttp dependency also and I forget to exclude/replace OkHttp there... @whataa: Do you think Pandora.getInterceptor() still useful after the plugin release? Removing this method from your public interface will allow to remove OkHttp dependency as well from your noop artifact improving the impact on release builds. |
Latest versions cause a startup crash when using Android R build tools (preview). They also have considerably increase the minimum Android API required to use Pandora to API 21 but the minSdkVersion flag of this library still allowing API 14.
Android R problem:
Pandora v2.0.6: FATAL EXCEPTION: java.lang.ExceptionInInitializerError at okhttp3.OkHttpClient.(OkHttpClient.kt:211)...
Pandora v2.0.3, v2.0.4 and v2.0.5: FATAL EXCEPTION: java.lang.NoSuchMethodError: No static method metafactory(...)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (...) at okhttp3.internal.Util.(Util.java:87)...
Pandora v2.0.2: Ok!
API<21 problem
Apps also crash if using latest versions in devices with API between 14 and 20:
Pandora v2.0.3, v2.0.4, v2.0.5 and v2.0.6: FATAL EXCEPTION: java.lang.ExceptionInInitializerError at okhttp3.OkHttpClient.(OkHttpClient.kt:211)... Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 19.
Cause
I believe all this issues are caused by the upgrade to Okhttp to v4.0.1 performed in Pandora v2.0.3.
Temporarily solution
We have downgrade Pandora to v2.0.2 and Retrofit to v2.3.0 (both using OkHttp 3.9.0). We can now run our app without problem from API 14 to latest API R (both included).
The text was updated successfully, but these errors were encountered: