androidruntimeexceptioninflate-exceptioninvocationtargetexception

when I run my app on device having api greater then 19 it gives me error


I am testing my app on diffrent api level. It works fine on minsdk i.e API 19 but when i run my app on device having API > 19 it give me runtime exception.

minSdk =19

TargetSdk =27

If my code is having any error or bug than it should not be run on any device. But it is running properly on device having API 19 but not on the device having API > 19.

Complete stack trace

Process: com.example.lenovo.jdstudio, PID: 5151
                  android.view.InflateException: Binary XML file line #33: Binary XML file line #33: Error inflating class android.widget.ScrollView
                  Caused by: android.view.InflateException: Binary XML file line #33: Error inflating class android.widget.ScrollView
                  Caused by: java.lang.reflect.InvocationTargetException
                      at java.lang.reflect.Constructor.newInstance0(Native Method)
                      at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                      at android.view.LayoutInflater.createView(LayoutInflater.java:652)
                      at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
                      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:742)
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:810)
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:522)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:430)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                      at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:414)
                      at com.android.internal.app.AlertController.installContent(AlertController.java:236)
                      at android.app.AlertDialog.onCreate(AlertDialog.java:423)
                      at android.app.ProgressDialog.onCreate(ProgressDialog.java:198)
                      at android.app.Dialog.dispatchOnCreate(Dialog.java:392)
                      at android.app.Dialog.show(Dialog.java:296)
                      at com.example.lenovo.jdstudio.SetupActivity.startSetupAccount(SetupActivity.java:95)
                      at com.example.lenovo.jdstudio.SetupActivity.access$000(SetupActivity.java:31)
                      at com.example.lenovo.jdstudio.SetupActivity$1.onClick(SetupActivity.java:68)
                      at android.view.View.performClick(View.java:5619)
                      at android.view.View$PerformClick.run(View.java:22295)
                      at android.os.Handler.handleCallback(Handler.java:754)
                      at android.os.Handler.dispatchMessage(Handler.java:95)
                      at android.os.Looper.loop(Looper.java:163)
                      at android.app.ActivityThread.main(ActivityThread.java:6342)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
                   Caused by: android.content.res.Resources$NotFoundException: Drawable android:drawable/scrollbar_handle_material with resource ID #0x108065d
                   Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-xxhdpi-v4/ic_arrow_back_black_24dp.png from drawable resource ID #0x7f0d0006: .xml extension required
                      at android.content.res.ResourcesImpl.loadComplexColorForCookie(ResourcesImpl.java:963)
                      at android.content.res.ResourcesImpl.loadComplexColorFromName(ResourcesImpl.java:784)
                      at android.content.res.ResourcesImpl.loadColorStateList(ResourcesImpl.java:863)
                      at android.content.res.Resources.loadColorStateList(Resources.java:1016)
                      at android.content.res.TypedArray.getColorStateList(TypedArray.java:533)
                      at android.graphics.drawable.GradientDrawable.updateStateFromTypedArray(GradientDrawable.java:1268)
                      at android.graphics.drawable.GradientDrawable.applyTheme(GradientDrawable.java:1206)
                      at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:594)
                      at android.content.res.MiuiResourcesImpl.loadDrawable(MiuiResourcesImpl.java:308)
                      at android.content.res.Resources.loadDrawable(Resources.java:872)
                      at android.content.res.TypedArray.getDrawable(TypedArray.java:930)
                      at android.view.View.initializeScrollbarsInternal(View.java:5101)
                      at android.view.View.<init>(View.java:4642)
                      at android.view.ViewGroup.<init>(ViewGroup.java:578)
                      at android.widget.FrameLayout.<init>(FrameLayout.java:92)
                      at android.widget.ScrollView.<init>(ScrollView.java:180)
E/AndroidRuntime:     at android.widget.ScrollView.<init>(ScrollView.java:176)
                      at android.widget.ScrollView.<init>(ScrollView.java:172)
                      at java.lang.reflect.Constructor.newInstance0(Native Method)
                      at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                      at android.view.LayoutInflater.createView(LayoutInflater.java:652)
                      at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
                      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:742)
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:810)
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:522)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:430)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                      at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:414)
                      at com.android.internal.app.AlertController.installContent(AlertController.java:236)
                      at android.app.AlertDialog.onCreate(AlertDialog.java:423)
                      at android.app.ProgressDialog.onCreate(ProgressDialog.java:198)
                      at android.app.Dialog.dispatchOnCreate(Dialog.java:392)
                      at android.app.Dialog.show(Dialog.java:296)
                      at com.example.lenovo.jdstudio.SetupActivity.startSetupAccount(SetupActivity.java:95)
                      at com.example.lenovo.jdstudio.SetupActivity.access$000(SetupActivity.java:31)
                      at com.example.lenovo.jdstudio.SetupActivity$1.onClick(SetupActivity.java:68)
                      at android.view.View.performClick(View.java:5619)
                      at android.view.View$PerformClick.run(View.java:22295)
                      at android.os.Handler.handleCallback(Handler.java:754)
                      at android.os.Handler.dispatchMessage(Handler.java:95)
                      at android.os.Looper.loop(Looper.java:163)
                      at android.app.ActivityThread.main(ActivityThread.java:6342)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

"activity_main.xml"

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.lenovo.jdstudio.MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <include
            layout="@layout/navigation_action"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/main_container">


        </FrameLayout>

    </LinearLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/navigation_header"
        app:menu="@menu/navigation_menu">
        <include
            layout="@layout/navigation_header" />
    </android.support.design.widget.NavigationView>

</android.support.v4.widget.DrawerLayout>

image_list.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="20dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/card_image"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:scaleType="centerCrop"
            android:src="@mipmap/placeholder4" />

        <TextView
            android:id="@+id/image_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="15dp"
            android:text="Image Title Goes Here"
            android:textSize="16dp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/image_resol"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="15dp"
            android:paddingLeft="15dp"
            android:paddingRight="15dp"
            android:text="Image Resol Goes here" />
    </LinearLayout>
</android.support.v7.widget.CardView>

fragment_home.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.lenovo.jdstudio.HomeFragment">


    <!-- TODO: Update blank fragment layout -->
    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/image_list">

    </android.support.v7.widget.RecyclerView>
</RelativeLayout>

Solution

  •  Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-xxhdpi-v4/ic_arrow_back_black_24dp.png from drawable resource ID #0x7f0d0006: 
    

    Resources$NotFoundException

    This exception is thrown by the resource APIs when a requested resource can not be found.

    Resources$NotFoundException: File res/mipmap-xxhdpi-v4/ic_arrow_back_black_24dp.png

    You should delete mipmap-xxhdpi-v4 folder. It should be mipmap-xxhdpi