Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Crashes when try to use either showDialog() or showBottomSheet() methods. #107

Open
haps87 opened this issue Apr 14, 2022 · 2 comments

Comments

@haps87
Copy link

haps87 commented Apr 14, 2022

Fatal Exception: java.lang.NoSuchFieldError
No static field country_flag of type I in class Lcom/mukesh/countrypicker/R$id; or its superclasses (declaration of 'com.mukesh.countrypicker.R$id' appears in /data/app/~~LBxrtR-zJZNjlGwTOmALag==/com.xyz-q5WhD_2SqWYbQIjrO3uc2g==/base.apk)

com.mukesh.countrypicker.CountriesAdapter$ViewHolder.<init> (CountriesAdapter.java:75)
com.mukesh.countrypicker.CountriesAdapter.onCreateViewHolder (CountriesAdapter.java:43)
com.mukesh.countrypicker.CountriesAdapter.onCreateViewHolder (CountriesAdapter.java:18)
androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder (RecyclerView.java:7078)

I had used the below version of the library.
implementation 'com.github.mukeshsolanki:country-picker-android:2.0.4'

Here is my applied code.

// Global variable
private CountryPicker countryPicker;
// OnViewCreated
countryPicker = new CountryPicker
                .Builder()
                .with(getContext())
                .listener(country -> {
                    countryCode = country.getDialCode();
                    imgCountry.setImageResource(country.getFlag());
                    Log.e("cSelection-Select", "" + countryCode + " / flag=" + country.getCode());
                })
                .build();
 // On Image Click where app crashes.
 countryPicker.showBottomSheet(activity);
@haps87 haps87 changed the title App Crashes when try to use either showDialog() or showBotoomSheet() methods. App Crashes when try to use either showDialog() or showBottomSheet() methods. Apr 14, 2022
@haps87
Copy link
Author

haps87 commented Apr 14, 2022

And the funny part is within OnViewCreated method, the below code works.

final Country userCountryInfo = countryPicker.getCountryFromSIM();
countryCode = userCountryInfo.getDialCode();
imgCountry.setImageResource(userCountryInfo.getFlag());
if (BuildConfig.DEBUG)
    Log.e("cSelection-Create", "" + countryCode + " / flag=" + userCountryInfo.getFlag());

@BharathKmalviya
Copy link

And the funny part is within OnViewCreated method, the below code works.

final Country userCountryInfo = countryPicker.getCountryFromSIM();
countryCode = userCountryInfo.getDialCode();
imgCountry.setImageResource(userCountryInfo.getFlag());
if (BuildConfig.DEBUG)
    Log.e("cSelection-Create", "" + countryCode + " / flag=" + userCountryInfo.getFlag());

I'm using this in activity and it's crashing!!

any update or solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants