ClassCastException on GradleBuildModel
I'm trying to get the applicationId from an Android module. Using
GradleBuildModel model = GradleBuildModel.get(module) which is working fine.
But as soon as I try to access the android() AndroidModel I get a:
java.lang.ClassCastException: com.android.tools.idea.gradle.util.BuildFileProcessor cannot be cast to com.android.tools.idea.gradle.util.BuildFileProcessor
although it is obviously the same class?
I'm using IntelliJ 2018.1 with gradle backed plugin and depedencies to android
compile fileTree(dir: '/Applications/IntelliJ IDEA CE.app/Contents/plugins/android/lib', include: ['*.jar'])
I'm tesing also in IntelliJ 2018.1 (per runIde gradle task).
Please sign in to leave a comment.
I found the solution myself. Use compileOnly instead of compile for the Android dependency to prevent classes from two different jars.