Comments (7)
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.
from pandora.
from pandora.
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.
from pandora.
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 minSdkVersion
to 21 but it will reduce Pandora compatibility. I would rather downgrade to OkHttp 3, but if you don't want it you could try a runtime fix selectively for lower platform levels. I mean something like preventing okHttp initialisation when running on API<21. It will allow the app to be started with others Pandora goodies but it will probably also stop any communications with backend servers if the host app rely on Retrofit/OkHttp or even a new crash when calling Retrofit Builder from the host app.
from pandora.
Thanks! As the OkHttp's README says:
- OkHttp 4.x works on Android 5.0+ (API level 21+) and Java 8+.
- OkHttp 3.12.x works on Android 2.3+ (API level 9+) and Java 7+.
For minSdkVersion < 21
, the project should choose using OkHttp 3.12.x. But since Pandora introduced version 4, you need to exclude it and implementation OkHttp 3.12.x
manually:
implementation ("com.github.whataa:pandora:v2.1.0") {
exclude group: 'com.squareup.okhttp3'
// or using: transitive false
}
implementation("com.squareup.okhttp3:okhttp:3.12.x")
the APIs Pandora used are included in every OkHttp version. That is, Pandora is independent of the specific version of OkHttp.
from pandora.
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:
- OKHTTP_VERSION = "3.12.10"
- RETROFIT_VERSION = "2.6.4"
But if your projects havesourceCompatibility JavaVersion.VERSION_1_7
, previous versions produce tons of warning on build time while performing transformClassesWithPandora
and pandora interceptor will not work on runtime despite a success build. They are all AGPBI warnings related to desugaring Retrofit Kotlin methods with R8. To solve this you can downgrade a bit more to following versions:
- OKHTTP_VERSION = "3.8.0"
- RETROFIT_VERSION = "2.3.0"
from pandora.
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.
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.
from pandora.
Related Issues (20)
- 空指针问题 HOT 5
- 尝试打开,为什么要先复制文件再去用其它软件打开 HOT 2
- 建议对于升级 OKHttp(3.14.0)应该使用大版本号 HOT 3
- ERROR: Failed to resolve: com.github.whataa:pandora-no-op:v2.0.5 HOT 1
- Support proguard/R8 mapping.txt file in crash logs screen HOT 1
- 文件上传问题 HOT 1
- 该工具会导致Fuel网络请求框架无法正常网络请求 HOT 1
- 使用Android Studio gradle build tools 3.6以上安装到手机上打开崩溃找不到R$drawable HOT 1
- Failed to resolve : androidx
- Add screen recording option
- Android 10.0 FileProvider导致运行就闪退 HOT 3
- Bug in English translation of permission request string
- 添加okhttp plugin,启动后崩溃
- Cannot launch debugger on emulator
- Duplicate network logs HOT 1
- Is it possible to use pandora in release mode?
- 编译报错
- 设置值没有对应正常
- Failed to apply plugin 'pandora-plugin'.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandora.