Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot cast object '[]' with class 'java.util.HashSet'

I'm trying to open a source code of Plumble , I changed gradle wrapper distributionUrl to 4.4 and then this gradle error appeared

tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }

I searched and figured out in gradle 4.4 "Compile" is undefined and I have to use JavaCompiler instead but then this error appeared

Could not find method jniDir() for arguments [C:\Users\NP\Desktop\Plumble-Legacy-master\build\native-libs] on task ':packageDebug' of type com.android.build.gradle.tasks.PackageApplication.

so I replaced

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

to

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

but now there is a new error in gradle building :

Cannot cast object '[]' with class 'java.util.HashSet' to class 'org.gradle.api.file.FileCollection' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.gradle.api.file.FileCollection()

does anybody know how can I fix this? any help will be much appreciated

like image 844
Shakib Karami Avatar asked Nov 07 '22 03:11

Shakib Karami


1 Answers

Even I faced the issue. The solution that worked for me is 1) Update the build script with the exact maven repo url. 2) add apply plugin : maven to the script.

like image 128
Spear A1 Avatar answered Nov 13 '22 02:11

Spear A1