MichaelRocks/libphonenumber-android

Upgrading to android gradle plugin version above 3.1.4 breaks library

Closed this issue · 5 comments

When updating to gradle 4.6 and gradle plugin 3.2.1 we get the following error

java.lang.IllegalStateException: missing metadata: /io/michaelrocks/libphonenumber/android/data/PhoneNumberMetadataProto_US

	at io.michaelrocks.libphonenumber.android.MetadataManager.getMetadataFromSingleFileName(MetadataManager.java:122)
	at io.michaelrocks.libphonenumber.android.MetadataManager.getMetadataFromMultiFilePrefix(MetadataManager.java:108)
	at io.michaelrocks.libphonenumber.android.MultiFileMetadataSourceImpl.getMetadataForRegion(MultiFileMetadataSourceImpl.java:72)
	at io.michaelrocks.libphonenumber.android.PhoneNumberUtil.getMetadataForRegion(PhoneNumberUtil.java:2228)
	at io.michaelrocks.libphonenumber.android.PhoneNumberUtil.parseHelper(PhoneNumberUtil.java:3183)
	at io.michaelrocks.libphonenumber.android.PhoneNumberUtil.parse(PhoneNumberUtil.java:3042)
	at io.michaelrocks.libphonenumber.android.PhoneNumberUtil.parse(PhoneNumberUtil.java:3032)
	at co.switchapp.objects.PhoneNumber$Companion.formatWithParentheses(PhoneNumber.kt:157)
	at co.switchapp.objects.PhoneNumber.getFormattedWithParenthesesAndOptionalLabel(PhoneNumber.kt:92)
	at co.switchapp.objects.PhoneNumber.getFormattedWithParenthesesAndLabel(PhoneNumber.kt:85)
	at co.switchapp.objects.Contact.getFormattedPrimaryPhoneWithLabel(Contact.kt:886)
	at co.switchapp.objects.ContactTest.phoneNumbersFormattedWithLabel(ContactTest.kt:24)

Have you checked if assets present in the APK file?

This is when running tests as you can see, but the assets seem to be there, but its not finding them for some reason. I suspect that the new gradle plugin changed the location or something. Can you update the library build version to 3.2.1 and see if that helps?

I'll try but I don't think it'll help.

Now the library is using version 3.4.1 of the Android plugin and also provides a DexGuard rule that keeps the data in assets (#17).

Thank you!