phonelib bug regarding cant find proto

Do you make use of PhoneNumberUtils in your android project?

If so, have you ever encountered this exception before?

java.lang.RuntimeException: cannot load/parse metadata: /com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MY at

If yes, chances are you are probably using [proguard][progaurd] to do the obfuscation of code. However, as this points out, proguard automatically also obfuscates the library files. However, the PhoneNumberUtils has a hardcoded path to the proto files. Therefore, one cannot rely on obfuscating the library’s code.

To resolve you must add the following lines in your proguard configuration file:

-keep class** { *; }

This problem occurs in Android version Honeycomb and below it, as versions after Honeycomb have their own phonenumber util included which has a namespace of If you are supporting version below honeycomb this can be an overlooked disaster.