Home > Software design >  Error inflating class androidx.appcompat.widget.AppCompatTextView
Error inflating class androidx.appcompat.widget.AppCompatTextView

Time:04-20

I got an error while rendering the view:

2022-04-20 10:46:55.361 9871-9871/? I/trolink.whatsU: Late-enabling -Xcheck:jni 2022-04-20 10:46:55.396 9871-9871/? E/trolink.whatsU: Unknown bits set in runtime_flags: 0x8000 2022-04-20 10:46:57.347 9871-9871/com.strolink.whatsUp I/Perf: Connecting to perf service. 2022-04-20 10:46:57.367 9871-9871/com.strolink.whatsUp I/MultiDex: VM with version 2.1.0 has multidex support 2022-04-20 10:46:57.367 9871-9871/com.strolink.whatsUp I/MultiDex: Installing application 2022-04-20 10:46:57.367 9871-9871/com.strolink.whatsUp I/MultiDex: VM has multidex support, MultiDex support library is disabled. 2022-04-20 10:46:57.424 9871-9871/com.strolink.whatsUp I/FeatureParser: can't find olive.xml in assets/device_features/,it may be in /system/etc/device_features 2022-04-20 10:46:57.520 9871-9871/com.strolink.whatsUp V/FA: Registered activity lifecycle callback 2022-04-20 10:46:57.523 9871-9871/com.strolink.whatsUp D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization. 2022-04-20 10:46:57.524 9871-9871/com.strolink.whatsUp D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization. 2022-04-20 10:46:57.525 9871-9871/com.strolink.whatsUp I/FirebaseInitProvider: FirebaseApp initialization successful 2022-04-20 10:46:57.613 9871-9914/com.strolink.whatsUp V/FA: Collection enabled 2022-04-20 10:46:57.614 9871-9914/com.strolink.whatsUp V/FA: App package, google app id: com.strolink.whatsUp, 1:957242236730:android:6ace47f1a2067c79db3a03 2022-04-20 10:46:57.616 9871-9914/com.strolink.whatsUp I/FA: App measurement is starting up, version: 16250 2022-04-20 10:46:57.616 9871-9914/com.strolink.whatsUp I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE 2022-04-20 10:46:57.616 9871-9914/com.strolink.whatsUp I/FA: To enable faster debug mode event logging run: adb shell setprop debug.firebase.analytics.app com.strolink.whatsUp 2022-04-20 10:46:57.617 9871-9914/com.strolink.whatsUp D/FA: Debug-level message logging enabled 2022-04-20 10:46:57.681 9871-9914/com.strolink.whatsUp V/FA: Connecting to remote service 2022-04-20 10:46:57.724 9871-9914/com.strolink.whatsUp V/FA: Connection attempt already in progress 2022-04-20 10:46:57.775 9871-9925/com.strolink.whatsUp D/NetworkSecurityConfig: No Network Security Config specified, using platform default 2022-04-20 10:46:57.776 9871-9925/com.strolink.whatsUp I/DpmTcmClient: RegisterTcmMonitor from: $Proxy0 2022-04-20 10:46:57.906 9871-9871/com.strolink.whatsUp W/Looper: Slow Looper main: Long Msg: seq=2 plan=۱۰:۴۶:۵۵.۴۴۰ late=2ms wall=2463ms running=0ms h=android.app.ActivityThread$H w=110 2022-04-20 10:46:57.907 9871-9934/com.strolink.whatsUp E/Perf: Fail to get file list com.strolink.whatsUp 2022-04-20 10:46:57.907 9871-9934/com.strolink.whatsUp E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array 2022-04-20 10:46:58.001 9871-9871/com.strolink.whatsUp V/FA: onActivityCreated 2022-04-20 10:46:58.035 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.040 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.050 9871-9871/com.strolink.whatsUp I/chatty: uid=10250(com.strolink.whatsUp) identical 2 lines 2022-04-20 10:46:58.052 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.064 9871-9871/com.strolink.whatsUp W/trolink.whatsU: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) 2022-04-20 10:46:58.065 9871-9871/com.strolink.whatsUp W/trolink.whatsU: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) 2022-04-20 10:46:58.069 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.073 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.077 9871-9871/com.strolink.whatsUp I/chatty: uid=10250(com.strolink.whatsUp) identical 2 lines 2022-04-20 10:46:58.087 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.100 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.103 9871-9871/com.strolink.whatsUp I/chatty: uid=10250(com.strolink.whatsUp) identical 1 line 2022-04-20 10:46:58.104 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.106 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.109 9871-9871/com.strolink.whatsUp I/chatty: uid=10250(com.strolink.whatsUp) identical 3 lines 2022-04-20 10:46:58.112 9871-9871/com.strolink.whatsUp D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.strolink.whatsUp activity: com.strolink.whatsUp.activities.welcome.IntroActivity@80a4d 2022-04-20 10:46:58.117 9871-9871/com.strolink.whatsUp D/AndroidRuntime: Shutting down VM

--------- beginning of crash

2022-04-20 10:46:58.121 9871-9871/com.strolink.whatsUp E/AndroidRuntime: FATAL EXCEPTION: main Process: com.strolink.whatsUp, PID: 9871 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.strolink.whatsUp/com.strolink.whatsUp.activities.welcome.IntroActivity}: android.view.InflateException: Binary XML file line #83 in com.strolink.whatsUp:layout/activity_intro_layout: Binary XML file line #83 in com.strolink.whatsUp:layout/activity_intro_layout: Error inflating class androidx.appcompat.widget.AppCompatTextView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3308) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3457) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7562) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) Caused by: android.view.InflateException: Binary XML file line #83 in com.strolink.whatsUp:layout/activity_intro_layout: Binary XML file line #83 in com.strolink.whatsUp:layout/activity_intro_layout: Error inflating class androidx.appcompat.widget.AppCompatTextView Caused by: android.view.InflateException: Binary XML file line #83 in com.strolink.whatsUp:layout/activity_intro_layout: Error inflating class androidx.appcompat.widget.AppCompatTextView 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:858) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088) at android.view.LayoutInflater.inflate(LayoutInflater.java:686) at android.view.LayoutInflater.inflate(LayoutInflater.java:538) at android.view.LayoutInflater.inflate(LayoutInflater.java:481) at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696) at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170) at com.strolink.whatsUp.activities.welcome.IntroActivity.onCreate(IntroActivity.java:96) at android.app.Activity.performCreate(Activity.java:7906) at android.app.Activity.performCreate(Activity.java:7893) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3283) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3457) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7562) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) 2022-04-20 10:46:58.122 9871-9871/com.strolink.whatsUp E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) Caused by: java.lang.IndexOutOfBoundsException: index=0 out of bounds (limit=0, nb=4) at java.nio.Buffer.checkIndex(Buffer.java:564) at java.nio.DirectByteBuffer.getInt(DirectByteBuffer.java:570) at android.graphics.fonts.FontFileUtil.analyzeStyle(FontFileUtil.java:94) at android.graphics.fonts.Font$Builder.build(Font.java:364) at android.graphics.Typeface$Builder.build(Typeface.java:606) at android.content.res.ResourcesImpl.loadFont(ResourcesImpl.java:1004) at android.content.res.Resources.getFont(Resources.java:414) at android.content.res.TypedArray.getFont(TypedArray.java:1037) at android.widget.TextView.readTextAppearance(TextView.java:3999) at android.widget.TextView.(TextView.java:1064) at android.widget.TextView.(TextView.java:968) at androidx.appcompat.widget.AppCompatTextView.(AppCompatTextView.java:100) at androidx.appcompat.widget.AppCompatTextView.(AppCompatTextView.java:95) ... 30 more 2022-04-20 10:46:58.146 9871-9871/com.strolink.whatsUp I/Process: Sending signal. PID: 9871 SIG: 9

activity_intro_layout :

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorWhite">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:layout_marginTop="88dp">

            <ImageView
                android:id="@ id/icon_image1"
                android:layout_width="120dp"
                android:layout_height="120dp"
                android:layout_gravity="center"
                android:background="@drawable/bg_logo_circle"
                android:padding="26dp"
                android:src="@drawable/intro1" />

            <ImageView
                android:id="@ id/icon_image2"
                android:layout_width="120dp"
                android:layout_height="120dp"
                android:layout_gravity="center"
                android:background="@drawable/bg_logo_circle"
                android:padding="6dp" />

        </FrameLayout>

        <androidx.viewpager.widget.ViewPager
            android:id="@ id/intro_view_pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />


        <LinearLayout
            android:id="@ id/bottom_pages"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="50dp"
            android:orientation="horizontal">

            <FrameLayout
                android:layout_width="8dp"
                android:layout_height="8dp"
                android:background="@drawable/bg_indicator" />

            <FrameLayout
                android:layout_width="8dp"
                android:layout_height="8dp"
                android:layout_marginLeft="7dp"
                android:background="@drawable/bg_indicator" />

            <FrameLayout
                android:layout_width="8dp"
                android:layout_height="8dp"
                android:layout_marginLeft="7dp"
                android:background="@drawable/bg_indicator" />

            <FrameLayout
                android:layout_width="8dp"
                android:layout_height="8dp"
                android:layout_marginLeft="7dp"
                android:background="@drawable/bg_indicator" />

            <FrameLayout
                android:layout_width="8dp"
                android:layout_height="8dp"
                android:layout_marginLeft="7dp"
                android:background="@drawable/bg_indicator" />


        </LinearLayout>

        <androidx.appcompat.widget.AppCompatTextView
            android:id="@ id/get_started_button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_gravity="center_horizontal"
            android:background="@color/colorAccent"
            android:gravity="center"
            android:padding="10dp"
            android:visibility="gone"
            android:text="@string/get_started"
            android:textColor="@color/colorWhite"
            android:textSize="18sp" />
    </RelativeLayout>

</ScrollView>

I found that it works well on the emulator with api 26. But on Android 10 (and maybe higher than Android 10) it gives this error

CodePudding user response:

Please check your texview ID in xml and your given ID in java file

CodePudding user response:

Well, healthily, I realized the problem after 2 hours. Let me just say that it was about how to use fonts in my program. If you would like to, I will provide you with a more complete explanation on how to solve this problem.

  • Related