chore(deps): drop Google's libphonenumber, use the Android port everywhere - #1272
Merged
Conversation
…where The app depended on two libphonenumber artifacts: the Android port (io.michaelrocks:libphonenumber-android) and Google's desktop artifact (com.googlecode.libphonenumber:libphonenumber). Each ships its own copy of the metadata, so any version skew between them meant the two could disagree on whether a number is valid — and since the port lags upstream, it always set the ceiling and blocked routine bumps of the Google artifact. Three of the four declarations were dead: :services:flipcash, :services:flipcash-compose and :services:opencode declared the Google artifact but had no Kotlin imports and no references to i18n/phonenumbers in their compiled output. Removed. The one real consumer, PhoneRegion in :shared:onramp:coinbase, is ported onto the Android artifact. That artifact loads its metadata from the AAR's assets rather than exposing a static instance, so it needs a Context — regionFromPhone becomes an injectable PhoneRegionResolver, mirroring PhoneUtils in :shared:phone (including the lazy PhoneNumberUtil so the metadata blob is parsed on first use rather than during construction on the main thread). The test moves to Robolectric for the Context. Its 13 cases and their expected values are unchanged on purpose: they are the parity check that the port agrees with Google's artifact on every number covered. With the Google artifact gone, the dependabot group rule that kept the two aliases in lockstep is no longer needed.
bmc08gt
force-pushed
the
claude/drop-google-libphonenumber
branch
from
August 20, 2026 16:08
5668443 to
e5c73c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The app depended on two libphonenumber artifacts:
io.michaelrocks:libphonenumber-android(the Android port):shared:phone,:shared:onramp:coinbasecom.googlecode.libphonenumber:libphonenumber(Google's desktop artifact):shared:onramp:coinbase, plus 3 dead declarationsEach ships its own copy of the metadata, so any version skew between them meant the two could disagree on whether a number is valid. The port lags upstream, so it always set the ceiling — which is why the catalog carried a "keep these pinned together" comment and a Dependabot group rule. In practice that just blocked routine bumps: #1259 was a Google-only 9.0.37 that the port had not published yet.
Dropping the Google artifact removes the skew risk and the pin.
What changed
Three of the four Google declarations were dead.
:services:flipcash,:services:flipcash-composeand:services:opencodeeach declared it, but have no Kotlin imports of it and no references toi18n/phonenumbersanywhere in their compiled output (build/tmp/kotlin-classes,build/intermediates/javac,build/generated). The catalog comment claimed "the services modules validate with Google's artifact" — that code does not exist. Removed.The one real consumer is ported.
PhoneRegion.regionFromPhonein:shared:onramp:coinbasemoves to the Android artifact. That artifact loads its metadata from the AAR's assets instead of exposing a staticgetInstance(), so it needs aContext— the top-level function becomes an injectablePhoneRegionResolver, mirroringPhoneUtilsin:shared:phone, lazyPhoneNumberUtilincluded so the metadata blob is parsed on first use rather than during construction on the main thread.The test moves to Robolectric for that
Context. Its 13 cases and their expected values are deliberately unchanged — they are the parity check that the port agrees with Google's artifact on every number covered.With the Google artifact gone, the Dependabot group rule that kept the two aliases in lockstep is no longer needed.
Verification
:shared:onramp:coinbase:test:shared:phone:test:services:flipcash:test— BUILD SUCCESSFUL;PhoneRegionTestreportstests="13" failures="0" errors="0":apps:flipcash:app:assembleDebug— BUILD SUCCESSFULdebugRuntimeClasspath: zerocom.googlecode.libphonenumberentries;io.michaelrocks:libphonenumber-android:9.0.36onlyNote on regionFromPhone
It currently has no production callers — only its own test.
CoinbaseOnrampApihas the matchingsubdivisionquery param, so it was built for a call that was never wired up. Ported rather than deleted, to keep that option open.Relationship to #1269
#1269 added an
ignorerule forcom.googlecode.libphonenumber:libphonenumber9.0.37 as a stopgap, and has since merged. This PR removes that rule along with the group rule — with the artifact gone from the build entirely, there is nothing left for either to act on.