CountryCodePicker icon indicating copy to clipboard operation
CountryCodePicker copied to clipboard

Error in Inflating view in some device

Open priyanka221 opened this issue 5 years ago • 12 comments

I integrate this library in my app. I t is working fine till now. but yesterday it crash in some user's device . Device list is as below: Xioami Redmi 5A Xioami Redmi 3S YuLong 3600i Samsung Galaxy J2 Pro And Android api version is Android 6.0.1 Android 8.1.0

Issues that is occurs: Caused by android.content.res.Resources$NotFoundException Unable to find resource ID #0x7f070175

android.content.res.Resources.getResourceName (Resources.java:3740) android.content.res.Resources.loadDrawableForCookie (Resources.java:4246) android.content.res.Resources.loadDrawable (Resources.java:4153) android.content.res.Resources.loadDrawable (Resources.java:3998) android.content.res.TypedArray.getDrawable (TypedArray.java:886) android.widget.ImageView. (ImageView.java:157) android.widget.ImageView. (ImageView.java:145) androidx.appcompat.widget.AppCompatImageView. (AppCompatImageView.java:72) androidx.appcompat.widget.AppCompatImageView. (AppCompatImageView.java:68) androidx.appcompat.app.AppCompatViewInflater.createImageView (AppCompatViewInflater.java:182) androidx.appcompat.app.AppCompatViewInflater.createView (AppCompatViewInflater.java:106) androidx.appcompat.app.AppCompatDelegateImpl.createView (AppCompatDelegateImpl.java:1266) androidx.appcompat.app.AppCompatDelegateImpl.onCreateView (AppCompatDelegateImpl.java:1316) android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:758) android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:716) android.view.LayoutInflater.rInflate (LayoutInflater.java:847) android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:810) android.view.LayoutInflater.rInflate (LayoutInflater.java:855) android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:810) android.view.LayoutInflater.inflate (LayoutInflater.java:527) android.view.LayoutInflater.inflate (LayoutInflater.java:429) android.view.LayoutInflater.inflate (LayoutInflater.java:380) android.view.View.inflate (View.java:21232) com.rilixtech.CountryCodePicker.init (CountryCodePicker.java:140) com.rilixtech.CountryCodePicker. (CountryCodePicker.java:124) java.lang.reflect.Constructor.newInstance (Constructor.java) android.view.LayoutInflater.createView (LayoutInflater.java:631) android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:776) android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:716) android.view.LayoutInflater.rInflate (LayoutInflater.java:847) android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:810) android.view.LayoutInflater.rInflate (LayoutInflater.java:855) android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:810) android.view.LayoutInflater.inflate (LayoutInflater.java:527) android.view.LayoutInflater.inflate (LayoutInflater.java:429)

Please help me to solve this issue.

priyanka221 avatar Sep 20 '19 06:09 priyanka221

What version of the library did you use? Did you upgrade the version to the current version? If yes, you should update all the related layout too because the package name for the library is changed for the recent version.

joielechong avatar Sep 24 '19 03:09 joielechong

Hello thank you for reply. I use 'com.github.joielechong:countrycodepicker:2.3.3' in my app.

and in xml file i use as below: <com.rilixtech.CountryCodePicker xmlns:n2=" http://schemas.android.com/apk/res-auto" android:id="@+id/cc_picker" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center" n2:ccp_hideNameCode="true" />

On Tue, Sep 24, 2019 at 9:13 AM Joielechong [email protected] wrote:

What version of the library did you use? Did you upgrade the version to the current version? If yes, you should update all the related layout too because the package name for the library is changed for the recent version.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joielechong/CountryCodePicker/issues/66?email_source=notifications&email_token=AMW56S6VFN5AUFVOIQYTZH3QLGEFFA5CNFSM4IYTLMO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7M6XOI#issuecomment-534375353, or mute the thread https://github.com/notifications/unsubscribe-auth/AMW56SZXNQ5HU22BSCW2NMLQLGEFFANCNFSM4IYTLMOQ .

priyanka221 avatar Sep 24 '19 09:09 priyanka221

This is seems related with the previous bug at issue #58. The resource layout of the library is being overrided by other layout. Please try using the latest version, 2.4.1.

joielechong avatar Sep 24 '19 09:09 joielechong

thanks. I will try using this version. If any error occur than ping you. One more thing I want to tell that in play store I upload my app as bundle means .aab , So is that create issue for this error?

On Tue, Sep 24, 2019 at 3:22 PM Joielechong [email protected] wrote:

This is seems related with the previous bug at issue #58 https://github.com/joielechong/CountryCodePicker/issues/58. The resource layout of the library is being overrided by other layout. Please try using the latest version, 2.4.1.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joielechong/CountryCodePicker/issues/66?email_source=notifications&email_token=AMW56SZ7LWRUAFHY2NTYASLQLHPOLA5CNFSM4IYTLMO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7NZJAI#issuecomment-534484097, or mute the thread https://github.com/notifications/unsubscribe-auth/AMW56S25LNYA6KZQ2ULYJ3DQLHPOLANCNFSM4IYTLMOQ .

priyanka221 avatar Sep 25 '19 13:09 priyanka221

yes, same with me, in my case my apk is working fine but while uploading the .aab, it throws android.content.res.Resources$NotFoundException, in some devices

pradipawasthi avatar Oct 22 '19 05:10 pradipawasthi

Did you using proguard in your project? What devices show the error?

Please provide the full log so I can investigate this issue asap.

joielechong avatar Oct 22 '19 07:10 joielechong

Or, can you provide a minimum sample app to reproduce the problem?

joielechong avatar Oct 22 '19 07:10 joielechong

This is list of device in which I fetch that problem: Xioami Redmi 5A Xioami Redmi 3S YuLong 3600i Samsung Galaxy J2 Pro And Android api version is Android 6.0.1 Android 8.1.0

I use Proguard in my project with minifyEnabled true shrinkResources true

My Proguard file is as below:

This is a configuration file for ProGuard.

http://proguard.sourceforge.net/index.html#manual/usage.html

This file is no longer maintained and is not used by new (2.2+) versions

of the

Android plugin for Gradle. Instead, the Android plugin for Gradle

generates the

default rules at build time and stores them in the build directory.

Optimizations: If you don't want to optimize, use the

proguard-android.txt configuration file instead of this one, which

turns off the optimization flags. Adding optimization introduces

certain risks, since for example not all optimizations performed by

ProGuard works on all versions of Dalvik. The following flags turn

off various optimizations known to have issues, but the list may not

be complete or up to date. (The "arithmetic" optimization can be

used if you are only targeting Android 2.0 or later.) Make sure you

test thoroughly if you go this route.

-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/,!class/merging/ -optimizationpasses 5 -allowaccessmodification -dontpreverify #-keepattributes Annotation

The remainder of this file is identical to the non-optimized version

of the Proguard configuration file (except that the other file has

flags to turn off optimization).

-dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -verbose

-keepattributes Annotation -keep public class com.google.vending.licensing.ILicensingService -keep public class com.android.vending.licensing.ILicensingService

For native methods, see

http://proguard.sourceforge.net/manual/examples.html#native -keepclasseswithmembernames class * { native ; }

keep setters in Views so that animations can still work.

see http://proguard.sourceforge.net/manual/examples.html#beans

-keepclassmembers public class * extends android.view.View { void set*(**); *** get(); }

We want to keep methods in Activity that could be used in the XML

attribute onClick -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); }

For enumeration classes, see

http://proguard.sourceforge.net/manual/examples.html#enumerations -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }

-keepclassmembers class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator CREATOR; }

-keepclassmembers class *.R$ { public static ; }

The support library contains references to newer platform versions.

Don't warn about those in case this app is linking against an older

platform version. We know about them, and they are safe.

-dontwarn android.support.**

Understand the @Keep support annotation.

-keep class android.support.annotation.Keep

-keep @android.support.annotation.Keep class * {*;}

-keepclasseswithmembers class * { @android.support.annotation.Keep ; }

-keepclasseswithmembers class * { @android.support.annotation.Keep ; }

-keepclasseswithmembers class * { @android.support.annotation.Keep (...); }

On Tue, Oct 22, 2019 at 1:19 PM Joielechong [email protected] wrote:

Did you using proguard in your project? What devices show the error?

Please provide the full log so I can investigate this issue asap.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joielechong/CountryCodePicker/issues/66?email_source=notifications&email_token=AMW56S4K6LXONJSUWK6EFILQP2V7BA5CNFSM4IYTLMO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB42VMA#issuecomment-544844464, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMW56S6HNA5Q2ACOPLDQ5Y3QP2V7BANCNFSM4IYTLMOQ .

priyanka221 avatar Nov 04 '19 10:11 priyanka221

Any updates on this issue? I have the same problem here for some devices and it keeps crashing for them.

I integrated with the latest version 'com.github.joielechong:countrycodepicker:2.4.1' but it still crashes.

My Proguard file: -keep class androidx.appcompat.widget.** { ; } -keep class cn.pedant.* { ; } -dontwarn afu.org.checkerframework.* -dontwarn org.checkerframework.** -dontwarn com.google.errorprone.** -dontwarn sun.misc.Unsafe -dontwarn java.lang.ClassValue -dontwarn com.google.android.material.snackbar.**

allow crashlytics to keep annotation and source stack for exceptions

-keepattributes Annotation -keepattributes SourceFile,LineNumberTable -keep public class * extends java.lang.Exception

david-young-fax avatar Dec 31 '19 22:12 david-young-fax

Any updates? There are still many crashes

david-young-fax avatar Jan 05 '20 05:01 david-young-fax

I also facing same error. Its working on my devices, but after uploading to playstore it is crashing on some devices. In firebase crashalytics title is like this XposedBridge.java (de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative) inside description it is like this: android.view.InflateException: Binary XML file line #51: Binary XML file line #51: Error inflating class com.rilixtech.widget.countrycodepicker.CountryCodePicker android.app.ActivityThread.performLaunchActivity

Devices facing crash are following: POCO F2 PRO Galaxy A21s ONEPLUS A5000 Galaxy S10 5G HOT5 Mi 9X Pixel 3a vivo S1 Huawei Enjoy 9s Samsung Galaxy A70

keyur1sst avatar Sep 03 '21 14:09 keyur1sst

The bug is still existing. You can add the Nexus 5X to that list.

MikaReesu avatar Sep 27 '22 05:09 MikaReesu