Skip to content

OkHttp update - #90

Merged
koutaku921 merged 5 commits into
payjp:masterfrom
bu-tokumitsu:fix/okhttp_update
Jun 5, 2026
Merged

OkHttp update#90
koutaku921 merged 5 commits into
payjp:masterfrom
bu-tokumitsu:fix/okhttp_update

Conversation

@bu-tokumitsu

@bu-tokumitsu bu-tokumitsu commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

概要

  • okHttp3のライブラリバージョンが coreloggingInterceptor でズレる場合にカード登録画面を開いたときにクラッシュが発生する問題の修正
    • 利用者側でOkHttpのcoreバージョンを更新してloggingInterceptorのバージョンと差分がある場合に発生します
    • flutter-pluginでも再現します
    • クラッシュ再現コミットは 7320041 になります
  • 不要になった通信処理を削除
  • APIバージョンの更新に伴い、robolectricのバージョンを更新

再現クラッシュログ

FATAL EXCEPTION: payjp
---------------------------
Process: com.example.payjp.sample, PID: 12563
java.lang.NoSuchMethodError: No virtual method log(ILjava/lang/String;Ljava/lang/Throwable;)V in class Lokhttp3/internal/platform/Platform; or its super classes (declaration of 'okhttp3.internal.platform.Platform' appears in /data/app/~~-lUBhtZKCvkVG-jqkUoq0g==/com.example.payjp.sample-jzLazjqCy7NEmD_e-bC1PQ==/base.apk!classes17.dex)
	at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:114)
	at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:173)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at jp.pay.android.network.CustomHeaderInterceptor.intercept(CustomHeaderInterceptor.kt:50)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
 	at java.lang.Thread.run(Thread.java:1119)

バージョン更新の影響

項目 旧 (3.12.x) 新 (4.12.0)
言語 Java Kotlin にリライト
最低要件 Java 7 / Android API 9+ Java 8+ / Android API 21+
Okio依存 Okio 1.x Okio 2.x → 3.x
  • minSdk引き上げ(API 16→21)
    • OkHttp の要件ではTLS 1.2の対応でサポート要件が引き上げられています、OkHttp更新後に21未満の端末で起動するとクラッシュが発生するためPAYJPのサポート範囲も更新の必要があります
  • 利用者が OkHttp 3.x を明示的に使っている場合に、このSDKを導入することで意図せず 4.x に引き上げられるケースがあります(Okioも同様)
    • Gradle の依存解決では、同一ライブラリの複数バージョンが競合した場合、デフォルトで最も高いバージョンが選択される仕様です

動作確認

  • OkHttp3を 4.12.0 に統一してsampleでカード登録が行えることを確認
  • Build and Testの通過を確認

@laiso laiso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正範囲の確認と、SDKサポートバージョン変更含めドキュメント部分を確認しました。
動作テストでもカードビューからAPI通信がクラッシュなく成功することをテストできました。

@koutaku921 koutaku921 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビュー結果を確認したため、approveします。

@koutaku921
koutaku921 merged commit bc8abd3 into payjp:master Jun 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants