title: Android studio with experimental gradle 0.2.0
body: <p>I am trying to setup a basic ndk build with the latest version of android studio at this moment. Trying to follow <a href="http://tools.android.com/tech-docs/new-build-system/gradle-experimental" rel="nofollow noreferrer">this tutorial</a> </p>
  
  <p><a href="https://i.stack.imgur.com/vU5y0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vU5y0.png" alt="enter image description here"></a></p>
  
  <p>This is my <strong>gradle-wrapper.properties</strong></p>
  
  <pre><code>#Thu Sep 17 14:22:34 CST 2015
  distributionBase=GRADLE_USER_HOME
  distributionPath=wrapper/dists
  zipStoreBase=GRADLE_USER_HOME
  zipStorePath=wrapper/dists
  distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
  </code></pre>
  
  <p>This is the project build.gradle</p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle-experimental:0.2.0'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          jcenter()
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  
  <p>Here is my module's build.gradle</p>
  
  <pre><code>apply plugin: 'com.android.model.application'
  
  model {
      android {
          compileSdkVersion = 23
          buildToolsVersion = "23.0.1"
  
          defaultConfig.with {
              applicationId = "me.blubee.testnative_exp"
              minSdkVersion = 10
              targetSdkVersion = 23
              versionCode = 1
              versionName = "1.0"
          }
  
          buildConfigFields.with {
              create() {
                  type = "int"
                  name = "VALUE"
                  value = "1"
              }
          }
  
          android.buildTypes {
              release {
                  minifyEnabled = false
                  proguardFiles += file('proguard-rules.pro')
              }
          }
  
          android.productFlavors {
              create("flavor1") {
                  applicationId = 'com.app'
              }
          }
  
          android.sources {
              main {
                  java {
                      source {
                          srcDir 'src'
                      }
                  }
              }
          }
  
      }
  }
  </code></pre>
  
  <p>my project structure looks like this:</p>
  
  <pre><code>APP
  Java/
  Java/android.support
  Java/com.test.test_experimental
  Java/com.test.test_experimental/R
  Java/com.test.test_experimental
  Java/com.test.test_experimentalBuildConfig
  Java/com.test.test_experimental
  Java/com.test.test_experimental/MainActivity
  tests/
  tests/com.test.test_experimental
  tests/com.test.test_experimental/ApplicationTest.java
  tests/com.test.test_experimental
  tests/com.test.test_experimental/BuildConfig.java
  resources/
  test-resources
  gradle/scripts/
  </code></pre>
  
  <p>I am getting these errors:</p>
  
  <pre><code>2:51:31 PM Gradle sync started
  2:51:34 PM Gradle sync failed: Unable to load class 'com.android.build.gradle.managed.ProductFlavor_Impl'.
             Consult IDE log for more details (Help | Show Log)
  
  Error:Unable to load class 'com.android.build.gradle.managed.ProductFlavor_Impl'.
  Possible causes for this unexpected error include:&lt;ul&gt;&lt;li&gt;Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
  &lt;a href="syncProject"&gt;Re-download dependencies and sync project (requires network)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
  &lt;a href="stopGradleDaemons"&gt;Stop Gradle build processes (requires restart)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.&lt;/li&gt;&lt;/ul&gt;In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
  
  
  Brother:TestNative_exp blubee$ ./gradlew clean --stacktrack
  
  FAILURE: Build failed with an exception.
  
  * Where:
  Build file '/Users/bb/TestNative_exp/app/build.gradle' line: 10
  
  * What went wrong:
  A problem occurred configuring project ':app'.
  &gt; Exception thrown while executing model rule: model.android
     &gt; Cannot set readonly property: minSdkVersion for class: com.android.build.gradle.managed.ProductFlavor_Impl
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug                                                                             option to get more log output.
  
  BUILD FAILED
  
  Total time: 2.619 secs
  </code></pre>
  
  <p><strong>line #10 is: minSdkVersion = 10</strong> 
  You can see the whole file in the <code>build.gradle</code> that i put above.</p>
  
  <p><strong>edit</strong></p>
  
  <p>As @unbekant pointed out in his comment and the link to <a href="http://tools.android.com/tech-docs/new-build-system/gradle-experimental" rel="nofollow noreferrer">this post</a></p>
  
  <p>The min and target sdk values should be set like this:</p>
  
  <pre><code>minSdkVersion.apiLevel = 15
  targetSdkVersion.apiLevel = 22
  </code></pre>
  
  <p>I tried that as well, I get this error:</p>
  
  <pre><code>* What went wrong:
  A problem occurred configuring project ':app'.
  &gt; Exception thrown while executing model rule: model.android
     &gt; No such property: buildConfigFields for class: com.android.build.gradle.managed.AndroidConfig
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug                                                                           option to get more log output.
  
  BUILD FAILED
  </code></pre>
  
  <p>What am I doing wrong?</p>