title: How to totally clear a Gradle dependency (Android app)
body: <p>I'm a newbie building an Android application in Android studio. I keep getting this Render error when I try to preview my layout file that looks like it traces back to the RecyclerView widget. I realized I wasn't actually using RecyclerView in my code, so I removed the line <code>compile 'com.android.support:cardview-v7:24.2.0'</code> from the dependency section in my <code>build.gradle</code>. But after I clean and rebuild and even delete everything from the <code>.gradle/caches</code> folder, I'm still getting the error. When I do a search of 'RecyclerView' in my code, I can see that there is still a package <code>android.support.v7.recyclerview</code> inside my <code>app</code> folder (even though I can't see these files in my actual directories?). </p>
  
  <p>How can I fully get rid of RecyclerView?</p>
  
  <p>Here is the stack trace for the error I'm seeing:</p>
  
  <blockquote>
    <p>java.lang.IllegalStateException: Unable to locate mode 0  at
    android.view.DisplayInfo.findMode(DisplayInfo.java:458)   at
    android.view.DisplayInfo.getMode(DisplayInfo.java:445)    at
    android.view.Display.getRefreshRate(Display.java:648)     at
    android.support.v7.widget.RecyclerView.onAttachedToWindow(RecyclerView.java:2392)
      at android.view.View.dispatchAttachedToWindow(View.java:15392)  at
    android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2953)
      at
    android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
      at
    android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
      at
    android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
      at
    android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
      at
    android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42)
      at
    com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:333)
      at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
      at
    com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
      at
    com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
      at
    com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
      at
    com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
      at
    com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
      at
    com.android.tools.idea.rendering.RenderTask.lambda$inflate$53(RenderTask.java:659)
      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)</p>
  </blockquote>
  
  <p>Any idea what is going on here?</p>
  
  <p><strong>EDIT:</strong><br>
  Here is my <code>build.gradle</code>:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 24
      buildToolsVersion "25.0.0"
      defaultConfig {
          applicationId "com.theprotectors.theprotectors"
          minSdkVersion 21
          targetSdkVersion 24
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner             "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:24.2.0'
      compile 'com.android.support:design:+'
      compile 'com.android.support:cardview-v7:24.2.0'
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
          exclude group: 'com.android.support', module: 'support-annotations'
      })
      compile 'com.android.support:appcompat-v7:24.2.1'
      testCompile 'junit:junit:4.12'
  }
  </code></pre>