Google AppInvites break build

2020-06-12 05:03发布

Part of our app's build.gradle is this:

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

For some reason when setting up AppInvites, build starts failing with following error:

* What went wrong:
A problem occurred configuring project ':app'.
> Cannot set the value of read-only property 'jniFolders' on task ':app:packageProdDebug'.

2条回答
够拽才男人
2楼-- · 2020-06-12 05:44

Same error when I tried to use Instant Run.

Fixed by adding this instead:

android {
  sourcesets {
    main {
      jniLibs.srcDir new File(buildDir, 'lib')
    {
  }
}

Reference: https://groups.google.com/forum/#!topic/adt-dev/OqDyZ5VN-QM

查看更多
Luminary・发光体
3楼-- · 2020-06-12 05:47

Change the gradle version to 1.3.1.

 dependencies {
     classpath 'com.android.tools.build:gradle:1.3.1'
 }
查看更多
登录 后发表回答