title: NPE while inflating layout (Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference)
body: <p>I keep getting a <code>java.lang.NullPointerException</code> when I try to use <code>ScrollView</code> in an activity. </p>
  
  <p>The weird thing is that I've used the exact same <code>Scrollview</code> setup in other activities. And all of a sudden I'm getting errors. I've tried cleaning the project and rebuilding.</p>
  
  <p>And I've tried the good old restart the program. I learned a lot about Null Pointer Exceptions today, but I haven't been able to figure out why I keep getting <strong>Rendering Problems</strong>.</p>
  
  <p>This is the <code>java.lang.NullPointerException</code> that is thrown on the XML:</p>
  
  <pre><code>java.lang.NullPointerException
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:738)
      at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:149)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:835)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
      at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:223)
      at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:426)
      at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
      at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:510)
      at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:498)
      at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:888)
      at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:498)
      at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:72)
      at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:610)
      at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:607)
      at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:362)
      at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:607)
      at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:629)
      at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:652)
      at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:80)
      at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:594)
      at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:152)
      at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:452)
      at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
      at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
      at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:137)
      at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:589)
      at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
      at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
      at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
      at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
      at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
      at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
      at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
      at com.intellij.util.Alarm$Request$1.run(Alarm.java:351)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>So, none of this is code that I wrote. So I dove into the stack trace and found this:</p>
  
  <pre><code>  java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
          at android.app.ActivityThread.access$800(ActivityThread.java:151)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:135)
          at android.app.ActivityThread.main(ActivityThread.java:5254)
          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:903)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
          Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:715)
                at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
                at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
                at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
                at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
                at android.app.Activity.setContentView(Activity.java:2145)
                at com.mitchellpalermo.tutroubleshooting.ContactPage.onCreate(ContactPage.java:11)
                at android.app.Activity.performCreate(Activity.java:5990)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
                at android.app.ActivityThread.access$800(ActivityThread.java:151) 
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
                at android.os.Handler.dispatchMessage(Handler.java:102) 
                at android.os.Looper.loop(Looper.java:135) 
                at android.app.ActivityThread.main(ActivityThread.java:5254) 
                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:903) 
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
  </code></pre>
  
  <p>Which points to <strong><em>line 11</em></strong> on the <strong><em>Contact.java</em></strong> file. Which looks like this (I've put indicators around line 11) :</p>
  
  <pre><code>  package com.mitchellpalermo.tutroubleshooting;
  
    import android.app.Activity;
    import android.os.Bundle;
  
    public class Contact extends Activity {
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_contact); // line 11
          }
    }
  </code></pre>
  
  <p>I don't see a problem with <strong><em>line 11</em></strong>. </p>
  
  <p>Now, I can't figure out what is wrong with my code. Between <strong>Rendering Problems</strong> and <code>NullPointerExceptions</code>, I can't figure out what is actually wrong with my code. </p>
  
  <p>This is an example of <strong>XML</strong> in an activity in which the <code>ScrollView</code> doesn't throw any errors:</p>
  
  <pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"
      tools:context="com.mitchellpalermo.tutroubleshooting.ComputerOrProjector"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:orientation="vertical"&gt;
  
          &lt;TextView
              style="@style/HeaderStyle"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:text="@string/solutions"
              android:textStyle="bold" /&gt;
  
          &lt;!-- A CardView that contains a TextView --&gt;
          &lt;android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_margin="15dp"
              card_view:cardBackgroundColor="#FFFFFF"
              card_view:cardCornerRadius="4dp"
              card_view:cardElevation="5dp"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"&gt;
  
                  &lt;TextView
                      style="@style/Solution"
                      android:text="@string/pc_v_fifth" /&gt;
  
                  &lt;View
                      android:layout_width="match_parent"
                      android:layout_height="2dp"
                      android:background="@android:color/darker_gray" /&gt;
  
                  &lt;TextView
                      style="@style/Solution"
                      android:text="@string/pc_v_first" /&gt;
  
                  &lt;View
                      android:layout_width="match_parent"
                      android:layout_height="2dp"
                      android:background="@android:color/darker_gray" /&gt;
  
                  &lt;TextView
                      style="@style/Solution"
                      android:text="@string/pc_v_second" /&gt;
  
                  &lt;View
                      android:layout_width="match_parent"
                      android:layout_height="2dp"
                      android:background="@android:color/darker_gray" /&gt;
  
                  &lt;TextView
                      style="@style/Solution"
                      android:text="@string/pc_v_third" /&gt;
  
                  &lt;View
                      android:layout_width="match_parent"
                      android:layout_height="2dp"
                      android:background="@android:color/darker_gray" /&gt;
  
  
                  &lt;TextView
                      style="@style/Solution"
                      android:text="@string/pc_v_fourth" /&gt;
  
                  &lt;View
                      android:layout_width="match_parent"
                      android:layout_height="2dp"
                      android:background="@android:color/darker_gray" /&gt;
  
              &lt;/LinearLayout&gt;
          &lt;/android.support.v7.widget.CardView&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"&gt;
  
              &lt;Button
                  style="@style/NextButton"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:onClick="sendEmail"
                  android:text="@string/fixed"
                  android:textStyle="bold" /&gt;
  
              &lt;Button
                  style="@style/NextButton"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:onClick="notFixedButton"
                  android:text="@string/not_fixed"
                  android:textStyle="bold" /&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>And here is the <strong>activity</strong> in which I receive errors:</p>
  
  <pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:fillViewport="false"&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"&gt;
  
          &lt;TextView
              style="@style/HeaderStyle"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:text="@string/still_not_fixed" /&gt;
  
          &lt;!-- A CardView that contains a TextView --&gt;
          &lt;android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_margin="15dp"
              card_view:cardBackgroundColor="#FFFFFF"
              card_view:cardCornerRadius="4dp"
              card_view:cardElevation="5dp"&gt;
  
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="@string/hector" /&gt;
  
              &lt;view
                  android:layout_width="match_parent"
                  android:layout_height="2dp"
                  android:backgroundTint="@android:color/darker_gray" /&gt;
  
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="@string/robert" /&gt;
  
              &lt;view
                  android:layout_width="match_parent"
                  android:layout_height="2dp"
                  android:backgroundTint="@android:color/darker_gray" /&gt;
  
              &lt;TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="@string/mitch" /&gt;
  
          &lt;/android.support.v7.widget.CardView&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>Any suggestions? And thank you so much in advance!</p>