lamudi-gmbh/android-phone-field

NoSuchMethodError: No virtual method parseAndKeepRawInput

zeroDivider opened this issue · 0 comments

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));
                }
            }
        });

Any advice? I am using your lib as:

    implementation('com.lamudi.phonefield:phone-field:0.1.3@aar') {
        transitive = true
    }

I added:

    implementation 'com.hbb20:ccp:2.7.3'

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.