A small library that allows you to create phone fields with corresponding country flags, and validate the phone number using libphonenumber from google.
Apache License 2.0
227
stars
67
forks
source link
NoSuchMethodError: No virtual method parseAndKeepRawInput #29
After adding another library using PhoneNumberUtils, I got massive crash:
java.lang.NoSuchMethodError: No virtual method parseAndKeepRawInput(Ljava/lang/String;Ljava/lang/String;)Lcom/google/i18n/phonenumbers/Phonenumber$PhoneNumber; in class Lcom/google/i18n/phonenumbers/PhoneNumberUtil; or its super classes (declaration of 'com.google.i18n.phonenumbers.PhoneNumberUtil' appears in /data/app/myapp-k09d0DyzNRI0pnj3Qg25Ww==/base.apk!classes33.dex)
Here:
phoneNumberButton.setOnClickListener(new OnOneClickListener() {
@Override
public void onOneClick(View v) {
String pattern = "^\\+[1-9]\\d{5,14}$";
if (phoneInputLayout.getPhoneNumber().matches(pattern)) { // <--------
// doing something here
} else {
phoneInputLayout.setError(getActivity().getResources().getString(R.string.bad_phone_number_format_error));
}
}
});
I have already tried putting this in proguard-rules.txt:
-keep public class com.google.i18n.phonenumbers.*
-keep public class com.lamudi.phonefield.*
Also, if I do this:
implementation('com.lamudi.phonefield:phone-field:0.1.3') {
include 'com.google.i18n.phonenumbers.*'
transitive = true
}
I get an error:
A problem occurred evaluating project ':app'.
> Could not find method include() for arguments [com.google.i18n.phonenumbers.*] on DefaultExternalModuleDependency{group='com.lamudi.phonefield', name='phone-field', version='0.1.3', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency.
After adding another library using
PhoneNumberUtils
, I got massive crash:Here:
Any advice? I am using your lib as:
I added:
I have already tried putting this in
proguard-rules.txt
:Also, if I do this:
I get an error: