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
we need to upgrade ok http to version 5, as this is a breaking release, we'll also need to make sure we include an exclamation mark in the commit message to bump the major version an avoid any upgrade issue for consumers. e.g. eat!:`
Vincent Biret (@baywet) I am currently in the process of making this upgrade across the board, however, I was wondering what would constitute considering this as a breaking release? From what I can tell there isn't any behavior changes that would cause use to raise code breaking changes for our customers or downstream in core and the client libraries.
Ramses Sanchez-Hernandez (@ramsessanchez)their changelog documents multiple breaking changes. This is most likely why they major bumped.
Now, let's assume that somebody has a kiota client in their application, and is also calling into another service using okhttp's APIs. If we push an update of okhttp on them through a minor/patch version, multiple things may happen:
if their application has a direct dependency on okhttp v4 (they should since in this scenario their code has a direct dependency), the resolver should complain about conflicting versions (v5 requested by kiota, v4 by their app), making it impossible for them to upgrade until they update their code, and change the version of the dependency in their application. Not something you'd expect via a minor/patch version update.
if their application does not have a direct dependency on okhttp v4, the resolver will happily upgrade the packages, but now their app will break at either build time or worse, runtime. Either way, not something you'd expect through a minor/patch version.
This is a typical diamond dependency problem. Which is why we need to major rev the packages in kiota (and subsequently graph core, graph service libs....)
Thankfully this is something we've already done in dotnet and we didn't get backlash from the community. So it's probably safe to do the same here. While we're at it, we might want to bundle other binary breaking changes to avoid having too frequent releases. Things like changing the minimum required Android SDK version, target java version etc... (if we need to). It'd be interesting to review the existing issues, todo comments, and point an agent at the repository with a "good prompt" to make sure nothing is missed. (don't let it loose and make the updates right away, have it create issues with detailed rationales first so we can discuss is, and have a record of the decision)
I hope all of that helps. Let me know if you have any additional comments or questions.
Our current plan is to upgrade OkHttp to version 5. Because this may introduce breaking changes for consumers, the upgrade would require a major-version release of Kiota Java (v2). That major-version change would cascade to the Microsoft Graph Java SDK and its Java core libraries.
We have also discussed the broader Java platform strategy with the Microsoft identity and Azure SDK for Java teams. Based on those discussions, we propose:
Continue supporting Java 8. This preserves stability for existing consumers and keeps us aligned with the Azure SDK for Java and the Microsoft identity libraries.
Stop Android-specific validation and testing. The Azure SDK for Java does not provide Android-specific validation, testing, or package releases. Given our current maintenance capacity, we propose following the same model across Kiota Java and the downstream Microsoft Graph Java libraries.
Remove the Jakarta Annotations dependency. The latest major version of Jakarta Annotations no longer supports Java 8. To avoid tying our Java support policy to that dependency, we propose using Microsoft-owned annotation providers or standard JDK annotations where possible.
This would not intentionally make the packages incompatible with Android. However, we would no longer maintain Android-specific packages or infrastructure, or validate and guarantee Android compatibility. Consumers could continue using the standard Java packages on Android where they work.
Before we move forward, we would appreciate feedback from Vincent Biret (@baywet) and other Java experts on this direction, particularly the proposed Java 8 support policy, the scope of Android support, and the replacement for Jakarta Annotations. Are there compatibility concerns or downstream impacts we should account for as part of these major-version releases?
This major-version update is also an opportunity to review our remaining dependencies. Are there other dependencies we should remove or replace to reduce our exposure to future changes in Java or tooling compatibility?
Why is that a cost today? It's validated by the CI, doesn't require significant work, and at least gives an option to android devs rather than none. I'm not in favour of dropping android support in Java unless we fund some alternative, like Kotlin for instance.
Remove the Jakarta Annotations dependency.
What's this Microsoft owned alternative? do you have any pointers to share?
I’d strongly argue against continuing to maintain Java 8 compatibility in 2026.
The ecosystem has moved on, and keeping such an old baseline will increasingly mean a significant maintenance burden, while also limiting access to upstream libraries fixes and support.
For context, both Spring 6 and Quarkus have already moved to Java 17 as their baseline. In my hands-on experience with other projects, even maintaining Java 11 compatibility is becoming a significant burden.
Given that the Kiota libraries are interchangeable, I’d propose the opposite approach: drop the old compatibility constraints and make Java 17 the baseline.
Users who need to remain on Java 8 can still do so, but I think the engineering burden of supporting that old runtime should sit with the consumer rather than the library maintainers.
I don’t have a specific requirement for Android, although I suspect there are users benefiting from the current compatibility there, so that’s probably worth considering separately.
As for Jakarta, I think that problem will largely solve itself once the Java baseline is raised.
Ramses Sanchez-Hernandez (@ramsessanchez) I think a data point that'd significantly help settle the "should we support android" discussion would be to use the component governance dashboard to see whether any internal Android application has a dependency on kiota. I know intune used to be a huge consumer early on, I wonder whether that's still the case.
Another data point is that we DON'T have any issue requesting Kotlin support at this point (but that could be self-fulfilling since those users might be using Java today)
I agree with Andrea on the Java 8 support. It's even highly debatable if Java 11 support is actually a good idea. You are locking yourself out of many options that have long become industry standard. I would go for 17 as a minimum. This whole ticket can be a none-issue if you switch to JDK 11 for example: from that version there's a Http client included in the JDK.
With respect to the annotations. I don't know what the annotations are used for, but the industry has long moved to the Jakarta namespace. Introducing your own set of annotations seems like the worst of all to me. Nobody will support those.
Trying to support these old versions can even make it hard or impossible to use the libraries on newer platforms. So you'll be dropping support for customers that do keep their versions up to date in favor of those neglecting to upgrade.
Thanks Emond Papegaaij (@papegaaij) for the thoughtful message!
For reference I already have an implementation using the JDK built-in Http Client here.
Thank you for jumping in, and pointing out the native alternative. The benefits being: it would allow us to drop a dependency. But that would come at a significant rewrite cost (middleware handler, etc...) and it's not supported by android. Worth considering if the team decides to drop android support in the end.
Only change was that body is not nullable anymore: MelleD#1
I also adapted core as well and removed the okhttp dep, because it comes transitive from kitoa-okhttp would not declare it twice, but to you can add tomorrow as well a branch here.
Missing part is the graph-sdk with my project but I think can test it as well this week
Since this is taking very long to unfold, a practical proposal would be to host the OkHttp 5 implementation (friendly fork 🙂) in the kiota-community repository, after is published people should be able to swap out the default and in the OkHttp5 even in graph (IIUC).
Local all tests are running. Have to test with my application but I think it's working. So I think no breaking change so far. Maybe this nullable thing not sure if it was intended to work with null body.
Android I cannot say :), maybe someone have to test
However, on that front, the last major version is almost 3 years old, so I don't think we'd get a lot of push back doing a major bump, especially if it's security related. As we do that, we should also evaluate SDK targets (android) and jdk versions.
Andrea Peruffo (@andreaTP) thanks for following up the conversation here. I don't think a soft fork of the package would do a service to the community and maybe create more confusion than anything if that makes sense?
to be clear, I'm suggesting we move forward, but also coordinate with other breaking changes. Assuming that Gavin Barron (@gavinbarron) doesn't have any issue with this.
Vincent Biret (@baywet) I lost track. What’s the breaking change for you? Is it the nullable body handling, or something else?
But you can remove OkHttp from both projects because it’s included transitively via Kiota. You only need to add it if you want to override Kiota’s OkHttp version.
For example, if Kiota has OKHTTP 5.0.0 and the Graph SDK wants to use 5.1.0, then the Graph SDK must include those dependencies.
My branches are already running fine with a clean install and the snapshots, even without the dependencies. The classpath is also exactly the same as before.
EDIT from graph sdk:
Here is the tree without direct dep:
on removing the dependency from the microsoft graph packages
I understand that it works but since those types are part of the public API of those packages, they should declare the dependency themselves. In the (unlikely) cases where kiota removes okhttp, makes it private, or that msgraph doesn't use kiota anymore, it'd be broken if they didn't. It also impacts how the javadoc works as well I believe, but that's beyond my expertise.
on why it's a breaking change.
That's because projects might rely on OkHttp APIs that are changing from 4 to 5 in their code, or have a dependency that does. And if kiota upgrades okhttp, they end up in a diamond dependency situation (effectively the same situation you're trying to currently solve, but with version numbers reversed).
I understand that it works but since those types are part of the public API of those packages, they should declare the dependency themselves. In the (unlikely) cases where kiota removes okhttp, makes it private, or that msgraph doesn't use kiota anymore, it'd be broken if they didn't. It also impacts how the javadoc works as well I believe, but that's beyond my expertis
That's just how Maven works, if Kiota removes it along with a (new) version, then the graph (since it's necessary at that point) should add the required Maven dependencies.
It would simply reduce the effort involved with the versions, and right now, declaring it offers no advantage and only creates extra work.
I'm just speaking from my own experience with Maven about how I would do it, but it's your decision.
For me, it doesn’t matter whether it’s part of the public API or not. I don’t see any connection there.
I hope that clarifies things a little?
It's really a matter of perspective whether you consider the breaking changes in a library to be breaking changes for your client as well. We see the same discussions way too often with Spring Boot, it's a matter of perspective. But okay, for me, a new major version is fine
by the way that are the breaking changes:
a) Response.Builder.body(null) is not allowed
b) OkHttpClient.clone() is replaced with newBuilder().build()
c) maven artifact id is okttp-jvm, but IMHO should nobody declare directly because it comes transitive
Major version bump: yes.kiota-http-okHttp is a thin layer over OkHttp, and OkHttp types are part of its public API (KiotaClientFactory.create() returns an OkHttpClient.Builder, every middleware is an okhttp3.Interceptor, and OkHttp is an api dependency). OkHttp's major version is effectively part of our contract, so our versioning should reflect it. That also avoids the diamond-dependency surprise Vincent Biret (@baywet) described.
No Java baseline change needed. OkHttp 5 still supports Java 8+ (README). I checked the 5.5.1 artifacts: okhttp-jvm, okio-jvm 3.18.1 and kotlin-stdlib 2.1.21 all ship Java 8 bytecode. We already target 1.8, so this upgrade is independent of the Java 8 vs 17 discussion, which we can settle separately.
Android: little to no change. OkHttp 5 requires API 21+, and we already require minSdk 26. Gradle-based Android builds pick up the okhttp-android AAR automatically through Gradle module metadata. The one thing to get right is publishing: for Maven users the plain okhttp artifact is now empty, so our POM should point at okhttp-jvm while our Gradle metadata keeps okhttp. That's how OkHttp's own logging-interceptor is published.
Switching our dependency to okhttp-jvm everywhere isn't enough: Android apps would then get the JVM jar instead of the Android AAR, losing OkHttp's Android-specific code. If the app also depends on okhttp itself, it would end up with both artifacts and duplicate classes.
The code changes look small (see Dennis Melzer (@MelleD)'s spike: mainly Response.Builder.body(null) no longer being allowed), and the legacy okhttp3.mockwebserver artifact is still published for 5.x, so our existing tests can keep using it.
All in all, I vote for upgrading to OkHttp 5 and shipping it as the next major release.
Switching our dependency to okhttp-jvm everywhere isn't enough: Android apps would then get the JVM jar instead of the Android AAR, losing OkHttp's Android-specific code. If the app also depends on okhttp itself, it would end up with both artifacts and duplicate classes.
But this is up for an test, I would expect gradle choose the right android already. But better safe than sorry we could add this there.
Make sure that okhttp-jvm is not additionally included transitively.
For Maven projects, the situation is different: Maven does not support Gradle Module Metadata and therefore does not automatically choose between JVM and Android.
In this case, the JVM variant must be used, so I would remove okhttp (because comes from kiota) but add directly okhttp-jvm
The Android build now uses JDK 17 or newer, but the library’s Java bytecode target remains Java 8 (targetCompatibility = 1.8). JVM consumers were also tested on Java 8.
The Android build-tool upgrade was driven by OkHttp 5.5.1: its Android artifact requires compileSdk 37, for which Android’s current guidance requires AGP 9.1.1 or later and Gradle 9. AGP 8.13 already requires JDK 17, but officially supports only up to API 36.1. So the prior comment was right that Gradle 9 cannot run on JDK 8;
For dependency selection, Gradle can choose the Android OkHttp variant automatically when Gradle module metadata is available. If an Android build uses only the Maven POM, it must exclude transitive okhttp-jvm and add okhttp-android explicitly to avoid including both variants. As far as I know there is no other way for maven and did it like other frameworks (spring tomcat vs jetty).
So the plan was not complete working as described, because build was breaking, but maybe easier to see the result to better discussion:
Activity
ramsessanchez commentedon Jul 15, 2026
Vincent Biret (@baywet) I am currently in the process of making this upgrade across the board, however, I was wondering what would constitute considering this as a breaking release? From what I can tell there isn't any behavior changes that would cause use to raise code breaking changes for our customers or downstream in core and the client libraries.
baywet commentedon Jul 16, 2026
Ramses Sanchez-Hernandez (@ramsessanchez) their changelog documents multiple breaking changes. This is most likely why they major bumped.
Now, let's assume that somebody has a kiota client in their application, and is also calling into another service using okhttp's APIs. If we push an update of okhttp on them through a minor/patch version, multiple things may happen:
This is a typical diamond dependency problem. Which is why we need to major rev the packages in kiota (and subsequently graph core, graph service libs....)
Thankfully this is something we've already done in dotnet and we didn't get backlash from the community. So it's probably safe to do the same here. While we're at it, we might want to bundle other binary breaking changes to avoid having too frequent releases. Things like changing the minimum required Android SDK version, target java version etc... (if we need to). It'd be interesting to review the existing issues, todo comments, and point an agent at the repository with a "good prompt" to make sure nothing is missed. (don't let it loose and make the updates right away, have it create issues with detailed rationales first so we can discuss is, and have a record of the decision)
I hope all of that helps. Let me know if you have any additional comments or questions.
ramsessanchez commentedon Aug 31, 2026
Proposed direction
Our current plan is to upgrade OkHttp to version 5. Because this may introduce breaking changes for consumers, the upgrade would require a major-version release of Kiota Java (v2). That major-version change would cascade to the Microsoft Graph Java SDK and its Java core libraries.
We have also discussed the broader Java platform strategy with the Microsoft identity and Azure SDK for Java teams. Based on those discussions, we propose:
This would not intentionally make the packages incompatible with Android. However, we would no longer maintain Android-specific packages or infrastructure, or validate and guarantee Android compatibility. Consumers could continue using the standard Java packages on Android where they work.
Before we move forward, we would appreciate feedback from Vincent Biret (@baywet) and other Java experts on this direction, particularly the proposed Java 8 support policy, the scope of Android support, and the replacement for Jakarta Annotations. Are there compatibility concerns or downstream impacts we should account for as part of these major-version releases?
This major-version update is also an opportunity to review our remaining dependencies. Are there other dependencies we should remove or replace to reduce our exposure to future changes in Java or tooling compatibility?
baywet commentedon Sep 1, 2026
Thank you for the additional information.
I have a couple of remarks here.
Why is that a cost today? It's validated by the CI, doesn't require significant work, and at least gives an option to android devs rather than none. I'm not in favour of dropping android support in Java unless we fund some alternative, like Kotlin for instance.
What's this Microsoft owned alternative? do you have any pointers to share?
CC Andrea Peruffo (@andreaTP)
andreaTP commentedon Sep 1, 2026
I’d strongly argue against continuing to maintain Java 8 compatibility in 2026.
The ecosystem has moved on, and keeping such an old baseline will increasingly mean a significant maintenance burden, while also limiting access to upstream libraries fixes and support.
For context, both Spring 6 and Quarkus have already moved to Java 17 as their baseline. In my hands-on experience with other projects, even maintaining Java 11 compatibility is becoming a significant burden.
Given that the Kiota libraries are interchangeable, I’d propose the opposite approach: drop the old compatibility constraints and make Java 17 the baseline.
Users who need to remain on Java 8 can still do so, but I think the engineering burden of supporting that old runtime should sit with the consumer rather than the library maintainers.
I don’t have a specific requirement for Android, although I suspect there are users benefiting from the current compatibility there, so that’s probably worth considering separately.
As for Jakarta, I think that problem will largely solve itself once the Java baseline is raised.
baywet commentedon Sep 1, 2026
Andrea Peruffo (@andreaTP) thanks for the input here!
Ramses Sanchez-Hernandez (@ramsessanchez) I think a data point that'd significantly help settle the "should we support android" discussion would be to use the component governance dashboard to see whether any internal Android application has a dependency on kiota. I know intune used to be a huge consumer early on, I wonder whether that's still the case.
Another data point is that we DON'T have any issue requesting Kotlin support at this point (but that could be self-fulfilling since those users might be using Java today)
Another aspect is that we have support for dart.
Another data point is that Google itself is building its apps using kotlin, encouraging people to do the same and the ecosystem has followed
papegaaij commentedon Sep 2, 2026
I agree with Andrea on the Java 8 support. It's even highly debatable if Java 11 support is actually a good idea. You are locking yourself out of many options that have long become industry standard. I would go for 17 as a minimum. This whole ticket can be a none-issue if you switch to JDK 11 for example: from that version there's a Http client included in the JDK.
With respect to the annotations. I don't know what the annotations are used for, but the industry has long moved to the Jakarta namespace. Introducing your own set of annotations seems like the worst of all to me. Nobody will support those.
Trying to support these old versions can even make it hard or impossible to use the libraries on newer platforms. So you'll be dropping support for customers that do keep their versions up to date in favor of those neglecting to upgrade.
andreaTP commentedon Sep 2, 2026
Thanks Emond Papegaaij (@papegaaij) for the thoughtful message!
For reference I already have an implementation using the JDK built-in Http Client here.
baywet commentedon Sep 2, 2026
Thank you for jumping in, and pointing out the native alternative. The benefits being: it would allow us to drop a dependency. But that would come at a significant rewrite cost (middleware handler, etc...) and it's not supported by android. Worth considering if the team decides to drop android support in the end.
maxandersen commentedon Sep 2, 2026
fwiw, agree with that if you are bumping things in a breaking way anyway basing on Java 17 is the new "base bottom" for java libraries"
MelleD commentedon Nov 17, 2026
Is there any news or are there any plans here, because okhttp 4.x have now CVEs. Because of this hard dep
Because of this hard dependency, we can't upgrade to 5.x.x. We use the msgraph-sdk-java.
We didn't encounter any breaking changes during our migration; we just had to include okhttp-jvm instead of okhttp.
2 remaining items
MelleD commentedon Nov 17, 2026
Andrea Peruffo (@andreaTP)
Only change was that body is not nullable anymore:
MelleD#1
I also adapted core as well and removed the okhttp dep, because it comes transitive from kitoa-okhttp would not declare it twice, but to you can add tomorrow as well a branch here.
Missing part is the graph-sdk with my project but I think can test it as well this week
andreaTP commentedon Nov 17, 2026
Dennis Melzer (@MelleD) thanks a lot for the spike, that's good context.
Since this is taking very long to unfold, a practical proposal would be to host the
OkHttp 5implementation (friendly fork 🙂) in thekiota-communityrepository, after is published people should be able to swap out the default and in the OkHttp5 even in graph (IIUC).Wdyt Vincent Biret (@baywet) ?
MelleD commentedon Nov 17, 2026
Just for complete picture. Both can remove okhttp directly because it is transitive
MelleD/msgraph-sdk-java-core#1
MelleD/msgraph-sdk-java#1
Local all tests are running. Have to test with my application but I think it's working. So I think no breaking change so far. Maybe this nullable thing not sure if it was intended to work with null body.
Android I cannot say :), maybe someone have to test
baywet commentedon Nov 17, 2026
Dennis Melzer (@MelleD) thanks for looking into this. I don't believe we can remove the dependency from the Microsoft Graph libs since there's direct usage and public API dependencies on the package
https://github.com/search?q=repo%3Amicrosoftgraph%2Fmsgraph-sdk-java+okhttp+language%3AJava&type=code&l=Java
https://github.com/search?q=repo%3Amicrosoftgraph%2Fmsgraph-sdk-java-core+okhttp+language%3AJava&type=code&l=Java
However, on that front, the last major version is almost 3 years old, so I don't think we'd get a lot of push back doing a major bump, especially if it's security related. As we do that, we should also evaluate SDK targets (android) and jdk versions.
Andrea Peruffo (@andreaTP) thanks for following up the conversation here. I don't think a soft fork of the package would do a service to the community and maybe create more confusion than anything if that makes sense?
andreaTP commentedon Nov 17, 2026
If you have a more structural solution I'm totally for it, I was proposing a (temporary?) workaround when we struggle to have a close.
baywet commentedon Nov 17, 2026
to be clear, I'm suggesting we move forward, but also coordinate with other breaking changes. Assuming that Gavin Barron (@gavinbarron) doesn't have any issue with this.
MelleD commentedon Nov 18, 2026
Vincent Biret (@baywet) I lost track. What’s the breaking change for you? Is it the nullable body handling, or something else?
But you can remove OkHttp from both projects because it’s included transitively via Kiota. You only need to add it if you want to override Kiota’s OkHttp version.
For example, if Kiota has OKHTTP 5.0.0 and the Graph SDK wants to use 5.1.0, then the Graph SDK must include those dependencies.
My branches are already running fine with a
clean installand the snapshots, even without the dependencies. The classpath is also exactly the same as before.EDIT from graph sdk:
Here is the tree without direct dep:
MelleD commentedon Nov 18, 2026
Test with my project and 3 branches:
No breaking changes all test passed:
Dep tree how expected only kiota http have the dep included on single place:
E.g.
If you want I can prepare PRs for all 3 repos, changes are very small. Test running locally also fine
baywet commentedon Nov 18, 2026
on removing the dependency from the microsoft graph packages
I understand that it works but since those types are part of the public API of those packages, they should declare the dependency themselves. In the (unlikely) cases where kiota removes okhttp, makes it private, or that msgraph doesn't use kiota anymore, it'd be broken if they didn't. It also impacts how the javadoc works as well I believe, but that's beyond my expertise.
on why it's a breaking change.
That's because projects might rely on OkHttp APIs that are changing from 4 to 5 in their code, or have a dependency that does. And if kiota upgrades okhttp, they end up in a diamond dependency situation (effectively the same situation you're trying to currently solve, but with version numbers reversed).
I hope that clarifies things a little?
MelleD commentedon Nov 18, 2026
That's just how Maven works, if Kiota removes it along with a (new) version, then the graph (since it's necessary at that point) should add the required Maven dependencies.
It would simply reduce the effort involved with the versions, and right now, declaring it offers no advantage and only creates extra work.
I'm just speaking from my own experience with Maven about how I would do it, but it's your decision.
For me, it doesn’t matter whether it’s part of the public API or not. I don’t see any connection there.
It's really a matter of perspective whether you consider the breaking changes in a library to be breaking changes for your client as well. We see the same discussions way too often with Spring Boot, it's a matter of perspective. But okay, for me, a new major version is fine
by the way that are the breaking changes:
a)
Response.Builder.body(null)is not allowedb)
OkHttpClient.clone()is replaced withnewBuilder().build()c) maven artifact id is
okttp-jvm, but IMHO should nobody declare directly because it comes transitiveNew MockWebServer3 changed api from
path→targetandreaTP commentedon Nov 18, 2026
Trying to sum up where I land on this:
Major version bump: yes.
kiota-http-okHttpis a thin layer over OkHttp, and OkHttp types are part of its public API (KiotaClientFactory.create()returns anOkHttpClient.Builder, every middleware is anokhttp3.Interceptor, and OkHttp is anapidependency). OkHttp's major version is effectively part of our contract, so our versioning should reflect it. That also avoids the diamond-dependency surprise Vincent Biret (@baywet) described.No Java baseline change needed. OkHttp 5 still supports Java 8+ (README). I checked the 5.5.1 artifacts:
okhttp-jvm,okio-jvm3.18.1 andkotlin-stdlib2.1.21 all ship Java 8 bytecode. We already target 1.8, so this upgrade is independent of the Java 8 vs 17 discussion, which we can settle separately.Android: little to no change. OkHttp 5 requires API 21+, and we already require
minSdk 26. Gradle-based Android builds pick up theokhttp-androidAAR automatically through Gradle module metadata. The one thing to get right is publishing: for Maven users the plainokhttpartifact is now empty, so our POM should point atokhttp-jvmwhile our Gradle metadata keepsokhttp. That's how OkHttp's ownlogging-interceptoris published.Switching our dependency to
okhttp-jvmeverywhere isn't enough: Android apps would then get the JVM jar instead of the Android AAR, losing OkHttp's Android-specific code. If the app also depends onokhttpitself, it would end up with both artifacts and duplicate classes.The code changes look small (see Dennis Melzer (@MelleD)'s spike: mainly
Response.Builder.body(null)no longer being allowed), and the legacyokhttp3.mockwebserverartifact is still published for 5.x, so our existing tests can keep using it.All in all, I vote for upgrading to OkHttp 5 and shipping it as the next major release.
MelleD commentedon Nov 19, 2026
Yes I added this in graph sdk https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp-android
I hope there are tests around because have no android projekt. Do you see more places to add
okhttp-android?MelleD commentedon Nov 20, 2026
Andrea Peruffo (@andreaTP) & Vincent Biret (@baywet)
My Proposal is:
In Kiota, I would declare the dependency as follows:
api(libs.com.squareup.okhttp3.okhttp)In other words, just the generic okhttp artifact—not okhttp-jvm as well.
This allows Gradle to select the appropriate variant based on the published Gradle Module Metadata.
Maven user have to decide if they need
androidorjvmfor gradle should workI would removes the direct OkHttp dependency and updates Kiota to 2.0.0.
I think that’s fundamentally the right approach.
In the Core, I wouldn’t add either
okhttp-jvmorokhttp-android.Why?
This makes sense in principle, since there are indeed different build systems here.
I would handle it as follows:
Android (android/build.gradle)
If the Kiota metadata does not automatically provide the Android variant, specify it explicitly:
But this is up for an test, I would expect gradle choose the right android already. But better safe than sorry we could add this there.
Make sure that okhttp-jvm is not additionally included transitively.
For Maven projects, the situation is different: Maven does not support Gradle Module Metadata and therefore does not automatically choose between JVM and Android.
In this case, the JVM variant must be used, so I would remove
okhttp(because comes from kiota) but add directlyokhttp-jvmMelleD commentedon Nov 24, 2026
The Android build now uses JDK 17 or newer, but the library’s Java bytecode target remains Java 8 (
targetCompatibility = 1.8). JVM consumers were also tested on Java 8.The Android build-tool upgrade was driven by OkHttp 5.5.1: its Android artifact requires
compileSdk37, for which Android’s current guidance requires AGP 9.1.1 or later and Gradle 9. AGP 8.13 already requires JDK 17, but officially supports only up to API 36.1. So the prior comment was right that Gradle 9 cannot run on JDK 8;For dependency selection, Gradle can choose the Android OkHttp variant automatically when Gradle module metadata is available. If an Android build uses only the Maven POM, it must exclude transitive
okhttp-jvmand addokhttp-androidexplicitly to avoid including both variants. As far as I know there is no other way for maven and did it like other frameworks (spring tomcat vs jetty).So the plan was not complete working as described, because build was breaking, but maybe easier to see the result to better discussion:
#2262
Gradle works with metadata:
Maven ships okhttp-jvm as default
Therefore the other two projects needs no deps, because it's transitive:
microsoftgraph/msgraph-sdk-java-core#2170
microsoftgraph/msgraph-sdk-java#2719