15

When updating to Android Studio 0.4, which uses the android gradle plugin 0.7.0 and gradle 1.9, following error occurs:

org.gradle.api.internal.MissingMethodException: Could not find method jniDir() ...

which refers to the follwing lines in my build.gradle:

 tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
   pkgTask.jniDir new File(projectDir, 'native-libs')
 }

P.S.: These answers fixed all other upgrade issues for me:

  1. https://stackoverflow.com/a/19496969/1137547
  2. https://stackoverflow.com/a/19461162/1137547
Community
  • 1
  • 1
Benjamin
  • 1,726
  • 1
  • 14
  • 35

1 Answers1

34

jniDir() has been replaced by jniFolders(). You can set it like this:

tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
    pkgTask.jniFolders = new HashSet<File>()
    pkgTask.jniFolders.add(new File(projectDir, 'native-libs'))
}

I found this solution in this discussion

Benjamin
  • 1,726
  • 1
  • 14
  • 35
  • What's the point of asking a question when you have the answer for it in the moment of asking? – XorOrNor Dec 20 '13 at 13:42
  • 12
    @soulreaver so other people can use it?! Why would SO offer the option to "Answer your own question" otherwise? – Benjamin Dec 20 '13 at 13:44