Java – Exception thrown during rendering: TabHost requires a TabWidget with id “android:id/tabs”

Exception thrown during rendering: TabHost requires a TabWidget with id “android:id/tabs”… here is a solution to the problem.

Exception thrown during rendering: TabHost requires a TabWidget with id “android:id/tabs”

There is a problem with Android Studio. Basically, I did what it said, but it produced a bug that I couldn’t figure out.

enter image description here

I’ve tried using android:id=”android:id/tabs”. Alas, this does not work either

This is 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"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context=". FindMyCar"
    android:id="@+id/">

<TabHost
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tabHost"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true">

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

<TabWidget
                android:id="android:id_tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"/>

<FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">

<LinearLayout
                    android:id="@+id/tabFind"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical">

</LinearLayout>

<LinearLayout
                    android:id="@+id/tabRandom"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical"></LinearLayout>

</FrameLayout>
        </LinearLayout>
    </TabHost>

</RelativeLayout>

Solution

I have tried using android:id=”android:id/tabs”

It should be android:id="@android:id/tabs"

Related Problems and Solutions