title: Converting Android Numberpicker Maven Project to Gradle Project For Android Studio
body: <p>So I've started using Android Studio and I wanted to use a number picker library for my project. Specifically this one:</p>
  
  <p><a href="https://github.com/SimonVT/android-numberpicker" rel="nofollow">https://github.com/SimonVT/android-numberpicker</a></p>
  
  <p>This is a maven project and my project is gradle based. In order to use this project in my app I would need to convert it into a gradle library project. Easy! Or so I thought...</p>
  
  <p>I used the following articles for guidance:</p>
  
  <p><a href="http://www.androidsx.com/how-to-link-an-android-library-project-with-gradle-in-android-studio/" rel="nofollow">http://www.androidsx.com/how-to-link-an-android-library-project-with-gradle-in-android-studio/</a>
  <a href="http://ryanharter.com/blog/2013/07/17/migrating-android-projects-to-gradle/" rel="nofollow">http://ryanharter.com/blog/2013/07/17/migrating-android-projects-to-gradle/</a></p>
  
  <p>My directory structure is as follows:</p>
  
  <pre><code>android-numberpicker/
     - android-numberpicker/
        - src/
           - main/
              - res/
              - java/
        - build.gradle
     - settings.gradle
     - build.gradle
  </code></pre>
  
  <p>My settings.gradle file</p>
  
  <pre><code>include ':android-numberpicker'
  </code></pre>
  
  <p>My build.gradle file:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.7.3'
      }
  }
  
  apply plugin: 'android-reporting'
  
  /**
   * Task to generate a gradle wrapper.
   */
  task wrapper(type: Wrapper) {
      gradleVersion = '1.9'
  }
  </code></pre>
  
  <p>and my android-numberpicker/build.gradle file looks like:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.7.3'
      }
  }
  
  apply plugin: 'android-library'
  
  repositories {
      mavenCentral()
  }
  
  android {
      compileSdkVersion 15
      buildToolsVersion "19.0.0"
  
      defaultConfig {
          minSdkVersion 7
          targetSdkVersion 15
      }
  }
  </code></pre>
  
  <p>Now I haven't even tried to integrate it with my project or android studio. I just want to see if I could build the project on its own. In other words i wanted to see if i had ported the project to gradle correctly. However when I run ./gradlew build (I am using the gradle wrapper) I get a series of errors such as:</p>
  
  <pre><code>NumberPicker.java:48: error: cannot find symbol
  import android.view.accessibility.AccessibilityNodeProvider;
                                   ^
  </code></pre>
  
  <p>No idea why gradle is doing this?</p>
  
  <p>I did notice in the original projects pom file the following dependency:</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.android&lt;/groupId&gt;
          &lt;artifactId&gt;android&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>Which I originally disregarded because I would have thought the 'android-library' plugin would automatically resolve the android sdk. However, when I got the above error I decided to add it to my android-numberpicker/build.gradle as follows:</p>
  
  <pre><code>dependencies {
      compile "com.google.android:android:+"
  }
  </code></pre>
  
  <p>I used compile, since the android-library doesn't seem to recognize provided as a valid scope. Upon running ./gradlew build I got a different error:</p>
  
  <blockquote>
    <p>ERROR: Debug has an indirect dependency on Android API level 15, but minSdkVersion for variant 'debug' is API level 7</p>
  </blockquote>
  
  <p>Again, not really sure why I am getting this error. Have reached a brick wall with regards to this issue. Any help would be greatly appreciated.</p>
  
  <p>Cheers</p>