0

here is the error i'm getting and i would appricieate some help from you guys:

Caused by: android.view.InflateException: You must specifiy a layout in the include tag: <include layout="@layout/layoutID" />

Here are my <include layout="@layout/layoutID" /> in activty_main.xml:

<include
android:layout="@layout/app_bar"
android:id="@+id/app_bar"/>

and here are my app_bar layout:

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary">

Please can someone help me with this. I'm new here in java programming.

Dusan Dimitrijevic
  • 3,169
  • 6
  • 22
  • 46
  • Are you using `Eclipse` or `AndroidStudio`? Try cleaning, opening, closing IDE. – hrskrs May 15 '15 at 10:40
  • try adding android.support.v7 jar file. – Aditi Parikh May 15 '15 at 10:41
  • @hrskrs I'm using AndroidStudio. I'll try that. – Dusan Dimitrijevic May 15 '15 at 10:46
  • @AditiParikh I don't know how to add it in AndroidStudio because i started using AndroidStudio yesterday and till then i was using an Eclipse. – Dusan Dimitrijevic May 15 '15 at 10:48
  • @DusanDimitrijevic you can add libraries using jar file or specifying Maven dependencies. To add jar put it inside the libs folder in the root folder of your main module (usually it called app - on the same level as folders build and src). Then right-click on the module name, select Open Module Settings, choose tab Dependencies and at the bottom press at the Plus sign and choose File dependency. To add Maven dependency select Library dependency and type artifact name – Oleg Osipenko May 15 '15 at 11:20

1 Answers1

1

Your exception message's already containing an answer: change include android:layout="@layout/app_bar" to include layout="@layout/app_bar"

Oleg Osipenko
  • 2,409
  • 1
  • 20
  • 28
  • Thank you for that, but now i'm getting this error message. By the way i'm trying to add my custom action bar. Here's the message: Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. Can you help me? – Dusan Dimitrijevic May 15 '15 at 13:52
  • 1
    As long as it another exception try to create another question. But this question has asked and answered many times, for example http://stackoverflow.com/a/26515159/3383038 Also consider to thoroughly read exception message - it's often contains the solution like this one – Oleg Osipenko May 15 '15 at 14:50