title: Cannot set the value of read-only property 'jniFolders' on task ':android:packageDebug'
body: <p>I wanted to open up and project in Android studio that I haven't worked on in a while, but when Android Studio tries to load the project it fails with this error message:</p>
  
  <pre><code>Error:(21, 0) Cannot set the value of read-only property 'jniFolders' on task ':android:packageDebug'.
  </code></pre>
  
  <p>I click on the link to the <code>build.gradle</code> and I guess these lines are the problem ...</p>
  
  <pre><code>// needed to add JNI shared libraries to APK when compiling on CLI
  tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask -&gt;
      pkgTask.jniFolders = new HashSet&lt;File&gt;()
      pkgTask.jniFolders.add(new File(projectDir, 'libs'))
  }
  </code></pre>
  
  <p>I see an answer here: <a href="https://stackoverflow.com/questions/33758421/google-appinvites-break-build">Google AppInvites break build</a> that says to ...</p>
  
  <blockquote>
    <p>Fixed by adding this instead:</p>
  
  <pre><code>android {
    sourcesets {
      main {
        jniLibs.srcDir new File(buildDir, 'lib')
      {
    }
  }
  </code></pre>
  </blockquote>
  
  <p>But the above answer is not very clear.  I am not sure what line to change and the braces in the answer do not seem to match up.</p>
  
  <p>I am at a total loss at what to do?  Any help is appreciated.</p>
  
  <p>Thanks</p>