There is a ClassCastException


(Axel Nennker) #1

org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection

There is another post that discusses this but that was for an older version.

I have:
ignisvulpis@namenlos:~/development/Android-IMSI-Catcher-Detector$ gradle -v


Gradle 3.2.1

Build time: 2016-11-22 15:19:54 UTC
Revision: 83b485b914fd4f335ad0e66af9d14aad458d2cc5

Groovy: 2.4.7
Ant: Apache Ant™ version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_111 (Oracle Corporation 25.111-b14)
OS: Linux 4.4.0-53-generic amd64

To reproduce:
Clone this repository:
git clone https://github.com/CellularPrivacy/Android-IMSI-Catcher-Detector
cd Android-IMSI-Catcher-Detector
gradle

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:AIMSICD’.

org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

// Sorry for the stupid title. The forum forced me.


(Benjamin Muschko) #2

Did you try out the Android plugin version as suggested in the other post?


(Axel Nennker) #3

No. I downgraded to gradle-2.1.4 and the build works.

ignisvulpis@namenlos:~$ gradle -v


Gradle 2.14.1

Build time: 2016-07-18 06:38:37 UTC
Revision: d9e2113d9fb05a5caabba61798bdb8dfdca83719

Groovy: 2.4.4
Ant: Apache Ant™ version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_111 (Oracle Corporation 25.111-b14)
OS: Linux 4.4.0-53-generic amd64

I still think that something is wrong with the new release.


(Axel Nennker) #4

s/2.1.4/2.14.1/
wrong version


(Benjamin Muschko) #5

You shouldn’t have to downgrade to an older version of Gradle. It’s actually better to move forward as you reap the benefits of other improvements in Gradle (most importantly performance). I believe to be able to use the Android plugin with the latest version of Gradle you’ll have to upgrade to the suggested Android plugin version.


(Axel Nennker) #6

Thanks. Still gradle 3.2.1 should should not crash anyway, right?!


(Benjamin Muschko) #7

The Android plugin likely uses internal APIs which simply became incompatible with API of Gradle 3.2.1. Therefore, the Android plugin released a new version to fix the issue. Is there any good reason not to upgrade to the latest Android plugin version?


(Axel Nennker) #8

dependencies {
classpath ‘com.android.tools.build:gradle:2.2.0’

works. Thank you.
Can’t gradle detect that 2.1.3 is not compatible with it?

That works with a from-source complied version of gradle too while the old Android plugin did not like the version number 3.4-20161214100956+0000


(Benjamin Muschko) #9

Gradle itself doesn’t know about external plugins. It’s up to the plugin to make the determination if it is compatible. I believe the Android plugin have a check built-in at some point of time. They might have taken it out. You might want to ask on the mailing list/user forum.