1

This is my xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="10dp"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_marginTop="10dp"
        android:layout_weight="1"
        android:background="@drawable/filebinder" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="14"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="10dp"
            android:orientation="horizontal">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="6"
                android:orientation="vertical">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:text="30 July"
                    android:textColor="#03a9f4"
                    android:textSize="32sp" />

            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

</LinearLayout>

and i am getting this in my android monitor

07-01 18:32:04.693 10005-10005/com.mindefy.kidster E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.zze.zzb
07-01 18:32:12.293 10005-10005/com.mindefy.kidster E/AndroidRuntime: FATAL EXCEPTION: main
                                                                     java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mindefy.kidster/com.mindefy.kidster.DiaryEntry.diaryEntryTeacherActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>

I am a beginner in android and i had read answers of various related questions but still i am not getting it where i am wrong.

Edit 1 - Removed unusual code.

2
  • Have you defined your Activity in manifest file? Commented Jul 1, 2016 at 13:13
  • yes i had defined it in manifest Commented Jul 1, 2016 at 13:27

4 Answers 4

7

I think the Problem is in your Drawable Image. The error InflateException is common issue is an out of memory exception when trying to inflate an imageview loading a drawable resource. If one of this resources has a high pixel resolution it would take a lot of memory causing then an inflate exception.

So basically verify that the pixel resolution in your drawables images are just the minimum necessary for your layout.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks @Ironman i had put my image in drawable v-21. i know it was silly but thanks anyways
i once encountered this problem while working with Android Studion choosing the Navigation template..all what i did was to make use of the drawable while ignoring the drawable v-21 which i think is causing the major problem here
2

I had this error message, When I was using a library called com.mikhaellopez:circularimageview and i had the image scale type set to Center_Inside

which was not supported by the library. After removing that line in the xml layout it worked fine.

Comments

0

@drawable/filebinder or @drawable/diarybookmark not a valid drawable.

Official doc: https://developer.android.com/guide/topics/resources/drawable-resource.html

Drawable could be png, jpg, gif files or drawable defined by a XML file as state drawable, shape drawable, ...

Comments

0

In my case the reason of this error was that I added the dimen resource to values-land/dimens.xml, but not in values/dimens.xml. Then IDE didn't show any warning/error but at runtime obviously the layout couldn't be drawn.

In general the best way is commenting/deletion views in the layout file one by one to realise which view causes an error.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.