ScrollView can host only one direct child but it has only one
<p>I keep getting this error whenever I start the activity.</p>

<p>Here's the complete stack trace:</p>

<pre><code>Process: com.example, PID: 28799
                                                                java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.activity.EditProjectActivity}: java.lang.IllegalStateException: ScrollView can host only one direct child
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2689)
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2754)
                                                                    at android.app.ActivityThread.access$900(ActivityThread.java:177)
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                    at android.os.Looper.loop(Looper.java:145)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:5938)
                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                    at java.lang.reflect.Method.invoke(Method.java:372)
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
                                                                 Caused by: java.lang.IllegalStateException: ScrollView can host only one direct child
                                                                    at android.widget.ScrollView.addView(ScrollView.java:416)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:822)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
                                                                    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
                                                                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                    at com.example.activity.EditProjectActivity.onCreate(EditProjectActivity.java:38)
                                                                    at android.app.Activity.performCreate(Activity.java:6288)
                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2642)
                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2754) 
                                                                    at android.app.ActivityThread.access$900(ActivityThread.java:177) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:145) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:5938) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 
</code></pre>

<p>And this is the layout file</p>

<pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".activity.EditProjectActivity"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    &gt;
    &lt;ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        &gt;
        &lt;RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            &gt;
                &lt;LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_centerHorizontal="true"
                    android:orientation="horizontal"
                    android:id="@+id/ep_layout_name"
                    &gt;
                    &lt;TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Project Name: "/&gt;
                    &lt;EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="10dp"
                        android:id="@+id/ep_edit_name"/&gt;
                &lt;/LinearLayout&gt;
                &lt;LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/ep_layout_name"
                    android:layout_marginTop="20dp"
                    android:layout_centerHorizontal="true"
                    android:orientation="vertical"
                    android:id="@+id/ep_layout_categories"
                    &gt;
                    &lt;ListView
                        android:id="@+id/ep_list_categories"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        /&gt;
                    &lt;Button
                        android:id="@+id/ep_btn_add_category"
                        android:layout_width="100dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="Add"
                        android:onClick="onAddCategoryButtonClick"
                        /&gt;
                &lt;/LinearLayout&gt;
                &lt;LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/ep_layout_categories"
                    android:layout_marginTop="20dp"
                    android:layout_centerHorizontal="true"
                    android:orientation="vertical"
                    android:id="@+id/ep_layout_versions"
                    &gt;
                    &lt;ListView
                        android:id="@+id/ep_list_versions"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        /&gt;
                    &lt;Button
                        android:id="@+id/ep_btn_add_version"
                        android:layout_width="100dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="Add"
                        android:onClick="onAddVersionButtonClick"
                        /&gt;
                &lt;/LinearLayout&gt;
        &lt;/RelativeLayout&gt;
    &lt;/ScrollView&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>I understand what the error means, and I've tried to solve it accordingly, but it still throws out the same exception.</p>

<p>The ScrollView has only one direct child and that is the RelativeLayout. I've also made it so that the ScrollView has a parent and is not the base view in case it was causing the exception but it didn't work.</p>