sentry-java
sentry-java copied to clipboard
Package OkHttp as a jar instead of aar
In order to use our OkHttp library with Jetpack Compose on desktop, it must be packaged as a jar
since it runs on the JVM.
Additionally we could deprecate sentry-android-okhttp
in favor of sentry-okhttp
if it doesn't have any Android specific dependency.
if we want to ship the proguard-rules.pro
for okhttp within our integration, it should be an aar, but we can move the SentryOkHttpInterceptor
class to a jar file and just ship the jar as a transitive dependency of the aar (its a breaking change tho)
Perhaps something for 6.0?
I have a feeling that with some Gradle magic we can actually publish both .aar with proguard rules and .jar without them from a single module, avoiding any breaking changes. Can look into this later
Java users would still need to import io.sentry.android.okhttp.SentryOkHttpInterceptor
which is weird, well, its just a package name, since we are cooking v6, it'd be fine.
It is not necessary to distribute as an aar to package proguard rules. Moshi is distributed as a jar and packages proguard rules. I'm not sure if that works with legacy proguard, but it does work with R8.
If you extract this jar you can see that you can bundle them using normal java resources. https://repo1.maven.org/maven2/com/squareup/moshi/moshi/1.12.0/moshi-1.12.0.jar
indeed @remcomokveld thanks for pointing this out. AGP is responsible for merging the proguard rules from aar/jar files before proguard/r8 runs, so it's more about a back-compatibility with older AGP versions. if we find out from which version this started being possible, we can also point out on docs and go with jar only.
Raised the priority to p2 here since our Kotlin Multiplatform SDK is moving forward with JVM support and we could unblock @remcomokveld and other folks who want to take advantage of this. Also it's a low effort.
If needed, we can have a sentry-okhttp
and sentry-android-okhttp
so people don't have to change their dependencies.
Maybe imports will be broken still, but its more straightforward to fix.
Closed by #3005