在升级到Android 0.4工作室,它采用了Android摇篮插件0.7.0和摇篮1.9,出现以下错误:
org.gradle.api.internal.MissingMethodException:找不到方法jniDir()...
这是指在我build.gradle的follwing行:
tasks.withType(com.android.build.gradle.tasks.PackageApplication){pkgTask - >
pkgTask.jniDir新的文件(PROJECTDIR,原生库)
}
PS:这些答案修复了所有其他的升级问题,对我来说:
http://stackoverflow.com/a/19496969/1137547 http://stackoverflow.com/a/19461162/1137547 解决方案jniDir()的已被取代的 jniFolders()的。您可以设置它是这样的:
tasks.withType(com.android.build.gradle.tasks.PackageApplication){pkgTask - >
pkgTask.jniFolders =新的HashSet<文件>()
pkgTask.jniFolders.add(新文件(PROJECTDIR,原生库))
}
我发现这个解决方案在此讨论
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:
http://stackoverflow.com/a/19496969/1137547 http://stackoverflow.com/a/19461162/1137547解决方案
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