Skip to content

Fix/okhttp update - #1

Closed
bu-tokumitsu wants to merge 5 commits into
masterfrom
fix/okhttp_update
Closed

bu-tokumitsu wants to merge 5 commits into
masterfrom
fix/okhttp_update

Conversation

@bu-tokumitsu

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

Copy link
Copy Markdown
Owner

概要

  • okHttp3のライブラリバージョンが core と loggingInterceptor でズレる場合にカード登録画面を開いたときにクラッシュが発生する問題の修正
    • 利用者側で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の通過を確認

@bu-tokumitsu

Copy link
Copy Markdown
Owner Author

本家にPR提出したのでこっちはクローズ

payjp#90

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.

1 participant