title: android RecyclerView onMeasure nullpointer
body: <p>I wanna use recyclerview, but null pointer has appeared. </p>
  
  <p>So I searched this issue, They said i have to make LinearLayoutManager set like below, I did it.: </p>
  
  <pre><code>setLayoutManager(new LinearLayoutManager(context))
  </code></pre>
  
  <p>But, It doesn't work. </p>
  
  <p>My error log is :</p>
  
  <pre><code>   java.lang.NullPointerException
          at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:1694)
          at android.view.View.measure(View.java:16628)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
          at android.view.View.measure(View.java:16628)
          at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:883)
          at android.view.View.measure(View.java:16628)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
          at android.view.View.measure(View.java:16628)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
          at android.view.View.measure(View.java:16628)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
          at android.view.View.measure(View.java:16628)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
          at android.view.View.measure(View.java:16628)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
          at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2298)
          at android.view.View.measure(View.java:16628)
          at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1916)
          at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1113)
          at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1295)
          at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
          at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5610)
          at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
          at android.view.Choreographer.doCallbacks(Choreographer.java:574)
          at android.view.Choreographer.doFrame(Choreographer.java:544)
          at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
          at android.os.Handler.handleCallback(Handler.java:733)
          at android.os.Handler.dispatchMessage(Handler.java:95)
          at android.os.Looper.loop(Looper.java:212)
          at android.app.ActivityThread.main(ActivityThread.java:5137)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:515)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
          at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>My code :</p>
  
  <pre><code>GridLayoutManager gridLayoutManager = new GridLayoutManager(IndexActivity.this , 2 );
          recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
          recyclerView.setLayoutManager(gridLayoutManager);
          recyclerView.setAdapter(mAdapter);
  </code></pre>
  
  <p>xml :</p>
  
  <pre><code>&lt;android.support.v7.widget.RecyclerView
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:horizontalSpacing="@dimen/index_gridview_horizontal_spacing"
              android:verticalSpacing="@dimen/index_gridview_vertical_spacing"
              android:numColumns="2"
              android:id="@+id/recyclerView" /&gt;
  </code></pre>
  
  <p>This problem was solved by changing gradle.</p>
  
  <p>My reference is here : beecanvas.com/yjcSh8Tp</p>