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

Crash when trying to open country picker #26

Open
davinh2306 opened this issue Mar 15, 2022 · 1 comment
Open

Crash when trying to open country picker #26

davinh2306 opened this issue Mar 15, 2022 · 1 comment

Comments

@davinh2306
Copy link

davinh2306 commented Mar 15, 2022

Hello,

I want to open the country picker but sadly I face this attribute at index 5 exception :

2022-03-15 19:09:32.599 15232-15232 E/AndroidRuntime: FATAL EXCEPTION: main
PID: 15232
android.view.InflateException: Binary XML file line #24 in layout/bottom_sheet_country_picker: Binary XML file line #24 in bottom_sheet_country_picker: Error inflating class androidx.appcompat.widget.AppCompatImageView
Caused by: android.view.InflateException: Binary XML file line #24 in bottom_sheet_country_picker: Error inflating class androidx.appcompat.widget.AppCompatImageView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:856)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:963)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1125)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1086)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1128)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1086)
at android.view.LayoutInflater.inflate(LayoutInflater.java:684)
at android.view.LayoutInflater.inflate(LayoutInflater.java:536)
at me.ibrahimsn.lib.databinding.BottomSheetCountryPickerBinding.inflate(BottomSheetCountryPickerBinding.java:56)
at me.ibrahimsn.lib.databinding.BottomSheetCountryPickerBinding.inflate(BottomSheetCountryPickerBinding.java:50)
at me.ibrahimsn.lib.internal.ui.CountryPickerBottomSheet.onCreateView(CountryPickerBottomSheet.kt:60)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2995)
at androidx.fragment.app.DialogFragment.performCreateView(DialogFragment.java:492)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:523)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1764)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:8061)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 5: TypedValue{t=0x2/d=0x7f0300f2 a=-1}
at android.content.res.TypedArray.getColorStateList(TypedArray.java:599)
at android.widget.ImageView.(ImageView.java:227)
at android.widget.ImageView.(ImageView.java:190)
at androidx.appcompat.widget.AppCompatImageView.(AppCompatImageView.java:78)
at androidx.appcompat.widget.AppCompatImageView.(AppCompatImageView.java:73)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:343) 
at android.view.LayoutInflater.createView(LayoutInflater.java:856) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:963) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1125) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1086) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1128) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1086) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:684) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:536) 
at me.ibrahimsn.lib.databinding.BottomSheetCountryPickerBinding.inflate(BottomSheetCountryPickerBinding.java:56) 
at me.ibrahimsn.lib.databinding.BottomSheetCountryPickerBinding.inflate(BottomSheetCountryPickerBinding.java:50) 
at me.ibrahimsn.lib.internal.ui.CountryPickerBottomSheet.onCreateView(CountryPickerBottomSheet.kt:60) 
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2995) 
at androidx.fragment.app.DialogFragment.performCreateView(DialogFragment.java:492) 
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:523) 
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261) 
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840) 
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1764) 
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701) 
at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488) 
at android.os.Handler.handleCallback(Handler.java:938) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:236) 
at android.app.ActivityThread.main(ActivityThread.java:8061) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) 

Here is my code :

    val localCountry = Locale.getDefault().country.lowercase()

    val phoneNumberKit = PhoneNumberKit.Builder(context)
        .setIconEnabled(true)
        .build()

    phoneNumberKit.attachToInput(phoneTextInputLayout, localCountry)

    context.getActivity()?.let {
        phoneNumberKit.setupCountryPicker(
            activity = it,
            searchEnabled = true
        )
    }

Is there anything obvious I am doing wrong?

Greetings,
David

@davinh2306 davinh2306 changed the title Crash when botto Crash when trying to open country picker Mar 15, 2022
@pcm2a
Copy link

pcm2a commented May 3, 2022

Having the same issue.

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