hbb20 / CountryCodePickerProject

Country Code Picker (CCP) is an android library which provides an easy way to search and select country or international phone code. Also supports Android EditText phone mask and international phone validation.
Apache License 2.0
1.52k stars 506 forks source link

Error inflating class com.hbb20.CountryCodePicker #384

Closed Mehedi111 closed 4 years ago

Mehedi111 commented 4 years ago

java.lang.RuntimeException: Unable to start activity ComponentInfo{activity name}: android.view.InflateException: Error inflating class com.hbb20.CountryCodePicker

1 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724) 2 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789) 3 at android.app.ActivityThread.-wrap12(ActivityThread.java) 4 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527) 5 at android.os.Handler.dispatchMessage(Handler.java:110) 6 at android.os.Looper.loop(Looper.java:203) 7 at android.app.ActivityThread.main(ActivityThread.java:6251) 8 at java.lang.reflect.Method.invoke(Native Method) 9 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) 10 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924) 11Caused by: android.view.InflateException: Binary XML file line #53: Binary XML file line #53: Error inflating class com.hbb20.CountryCodePicker 12Caused by: android.view.InflateException: Binary XML file line #53: Error inflating class com.hbb20.CountryCodePicker 13Caused by: java.lang.reflect.InvocationTargetException 14 at java.lang.reflect.Constructor.newInstance0(Native Method) 15 at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 16 at android.view.LayoutInflater.createView(LayoutInflater.java:645) 17 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 18 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 19 at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 20 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 21 at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 22 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 23 at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 24 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 25 at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 26 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 27 at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 28 at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 29 at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 30 at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555) 31 at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161) 32 at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303) 33 at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284) 34 at com.gm.shadhin.ui.login.SignInActivity.onCreate(SignInActivity.java:45) 35 at android.app.Activity.performCreate(Activity.java:6666) 36 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 37 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677) 38 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789) 39 at android.app.ActivityThread.-wrap12(ActivityThread.java) 40 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527) 41 at android.os.Handler.dispatchMessage(Handler.java:110) 42 at android.os.Looper.loop(Looper.java:203) 43 at android.app.ActivityThread.main(ActivityThread.java:6251) 44 at java.lang.reflect.Method.invoke(Native Method) 45 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) 46 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924) 47Caused by: android.view.InflateException: Binary XML file line #52: Binary XML file line #52: Error inflating class ImageView 48Caused by: android.view.InflateException: Binary XML file line #52: Error inflating class ImageView 49Caused by: android.content.res.Resources$NotFoundException: Drawable (missing name) with resource ID #0x7f08009c 50Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f08009c 51 at android.content.res.ResourcesImpl.getResourceName(ResourcesImpl.java:228) 52 at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:687) 53 at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:571) 54 at android.content.res.Resources.loadDrawable(Resources.java:972) 55 at android.content.res.TypedArray.getDrawable(TypedArray.java:931) 56 at android.widget.ImageView.<init>(ImageView.java:157) 57 at android.widget.ImageView.<init>(ImageView.java:145) 58 at androidx.appcompat.widget.AppCompatImageView.<init>(AppCompatImageView.java:72) 59 at androidx.appcompat.widget.AppCompatImageView.<init>(AppCompatImageView.java:68) 60 at androidx.appcompat.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:187) 61 at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:107) 62 at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1407) 63 at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1457) 64 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769) 65 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 66 at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 67 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 68 at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 69 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 70 at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 71 at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 72 at com.hbb20.CountryCodePicker.init(CountryCodePicker.java:212) 73 at com.hbb20.CountryCodePicker.<init>(CountryCodePicker.java:160) 74 at java.lang.reflect.Constructor.newInstance0(Native Method) 75 at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 76 at android.view.LayoutInflater.createView(LayoutInflater.java:645) 77 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 78 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 79 at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 80 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 81 at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 82 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 83 at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 84 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 85 at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 86 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 87 at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 88 at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 89 at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 90 at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555) 91 at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161) 92 at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303) 93 at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284) 94 at com.gm.shadhin.ui.login.SignInActivity.onCreate(SignInActivity.java:45) 95 at android.app.Activity.performCreate(Activity.java:6666) 96 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 97 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677) 98 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789) 99 at android.app.ActivityThread.-wrap12(ActivityThread.java) 100 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527) 101 at android.os.Handler.dispatchMessage(Handler.java:110) 102 at android.os.Looper.loop(Looper.java:203) 103 at android.app.ActivityThread.main(ActivityThread.java:6251) 104 at java.lang.reflect.Method.invoke(Native Method) 105 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) 106 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)

I have used this library in my live project and got lots of crashes

hbb20 commented 4 years ago

Sorry to hear that.. Seems like some drawable is not bundled correctly. Are you able to reproduce this?

Mehedi111 commented 4 years ago

I got this issue only some device

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{activity name}: android.view.InflateException: Binary XML file line #76: Binary XML file line #76: Error inflating class com.hbb20.CountryCodePicker at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2977) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3114) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:201) at android.app.ActivityThread.main(ActivityThread.java:6831) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:927)

NadaLess commented 4 years ago

Hi I've got same issue. Any idea on how to fix it?

Mehedi111 commented 4 years ago

@NadaLess not yet

hbb20 commented 4 years ago

I would like to fix this issue but unable to produce on my devices. Is anyone able to reproduce on their physical phone? If so, can you help me test potential fix?

hbb20 commented 4 years ago

Thank you for reporting. It seems like this issue is similar to #403. It will be helpful if we continue discussion on a single thread. Further discussion can be found on #403.