Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout in Android 11 - android

When Run the app in android 10. Its works properly, If adding support for android 11. It does not work. And before Was 28/android 9. then updated 30/android 11
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.folder, PID: 17183
java.lang.RuntimeException: Unable to start activity ComponentInfo{ABCActivity}: android.view.InflateException: Binary XML file line #17 in com.app.folder:layout/abc_screen_simple: Binary XML file line #17 in com.app.folder:layout/abc_screen_simple: Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout
Gradle. also, the latest version was added.
implementation 'androidx.appcompat:appcompat:1.4.0'

Related

Error inflating class androidx.appcompat.widget.AppCompatSpinner

We are seeing a crash Error inflating class androidx.appcompat.widget.AppCompatSpinner on the play console,but we are not able to reproduce it.
Here is my xml :
<androidx.appcompat.widget.AppCompatSpinner
android:id="#+id/spinnerState"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/xMargin_42_156"
android:layout_marginEnd="#dimen/xMargin_42_156"
android:background="#drawable/spinner_down_arrow"
android:focusableInTouchMode="true"
android:overlapAnchor="false"/>
In build.gradle
implementation 'androidx.appcompat:appcompat:1.2.0'
Logs:
Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{com.wrap/com.wrap.activities.NewIntroActivity}: android.view.InflateException: Binary XML file line #129 in com.wrap:layout/activity_new_intro: Binary XML file line #129 in com.wrap:layout/activity_new_intro: Error inflating class androidx.appcompat.widget.AppCompatSpinner

Failed to load WebView provider: No WebView installed android.webkit.WebViewFactory.getProviderClass

In the project that I am currently working on uses a webview for Login (OAuth). Please find the below stackTace where the activity has not been inflated and has been crashed. The below is the exact exception seen in the firebase crashlytics.
Fatal Exception: java.lang.RuntimeException Unable to start activity
ComponentInfo{{package}/{classname}}: android.view.InflateException:
Binary XML file line #14 in {package}:layout/{activity_xml_file}:
Binary XML file line #14 in {package}:layout/{activity_xml_file}:
Error inflating class android.webkit.WebView
Caused by android.view.InflateException Binary XML file line #14 in
{package}:layout/{activity_xml_file}: Binary XML file line #14 in
{package}:layout/{activity_xml_file}: Error inflating class
android.webkit.WebView
Caused by android.view.InflateException Binary XML file line #14 in
{package}:layout/{activity_xml_file}: Error inflating class
android.webkit.WebView
Caused by java.lang.reflect.InvocationTargetException
java.lang.reflect.Constructor.newInstance0
Caused by
android.webkit.WebViewFactory$MissingWebViewPackageException Failed
to load WebView provider: No WebView installed
The crash has occurred on setContentView of the activity, when on setting the view to the respective activity.
On looking into other solutions from StackOverFlow, some suggested to use try and catch block on loading the view to the activity setContentView().
Is there any possible way to handle this other than try and catch.
Referred Links :
android Failed to load WebView provider: No WebView installed

Unable to start activity ComponentInfo android.view.InflateException: Binary XML file line #17 in layout/abc_screen_toolbar:

Caused by: android.view.InflateException: Binary XML file line #17 in com.acadamis.vidyaspoorthiteacher:layout/abc_screen_toolbar: Binary XML file line #17 in com.acadamis.vidyaspoorthiteacher:layout/abc_screen_toolbar: Error inflating class androidx.appcompat.widget.ActionBarOverlayLayout
Caused by: android.view.InflateException: Binary XML file line #17 in com.acadamis.vidyaspoorthiteacher:layout/abc_screen_toolbar: Error inflating class androidx.appcompat.widget.ActionBarOverlayLayout
AndroidRuntime: at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
** It's working up to API 28, but not for API 29
This problem happens when using calligraphy library.
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
Solution:
Replace new calligraphy library
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
Change the calligraphy initial code
ViewPump.init(ViewPump.builder()
.addInterceptor(new CalligraphyInterceptor(
new CalligraphyConfig.Builder()
.setDefaultFontPath("1.ttf")
.setFontAttrId(R.attr.fontPath)
.build()))
.build());
And change wrapper
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));

com.android.support:design with androidX (1.0.2)

I want to use TextInputLayout inside my project, but I'm using androidX library
implementation "androidx.appcompat:appcompat:1.0.2"
/*this don't work*/
implementation "com.android.support:design:28.0.0"
This is the exception which I'm facing
android.view.InflateException: Binary XML file line #30: Binary XML file line #30: Error inflating class android.support.design.widget.TextInputLayout
Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class android.support.design.widget.TextInputLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.TextInputLayout" on path: DexPathList[[zip file "/data/app/com.example
Error inflating class android.support.design.widget.TextInputLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class
This error thrown when the Java Virtual Machine (JVM) tries to load a particular class and the specified class cannot be found in the classpath.
You should use
com.google.android.material.textfield.TextInputLayout
DEMO
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
Then Clean-Rebuild-Run.

Generating signed apk getting error on inflating BottomNavigationView after switching to androidX

App crashes with error error inflating class com.google.android.material.bottomnavigation.BottomNavigationView when generating signed apk. Running the app with debug apk from android studio directly to device has no problem. I have migrated my project to androidX as well.
I've read some other post saying the drawable or colors might have problem so I've confirm that there are no other drawable folders (e.g. drawable-v21, drawable-v24). Im not sure why but it only happens when I generate a signed apk.
app:itemIconTint="#drawable/drawable_selector"
app:itemTextColor="#drawable/drawable_selector"
app:itemBackground="#color/primary"
but it doesn't work
line 15 error starts here:
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:menu="#menu/bottom_navigation"
android:elevation="8dp"
app:itemIconTint="#drawable/drawable_selector"
app:itemTextColor="#drawable/drawable_selector"
app:itemBackground="#color/primary"
android:background="?android:attr/windowBackground"/>
have already included this in my gradle:
implementation 'com.google.android.material:material:1.1.0-alpha06'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
Caused by: android.view.InflateException: Binary XML file line #15: Binary XML file line #15: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
Caused by: java.lang.reflect.InvocationTargetException

Categories

Resources