Cannot apply plugin into Android multi module project
See original GitHub issueI cannot find a way to apply this plugin into my Android project. I tried both approaches:
plugins {
id "org.jlleitschuh.gradle.ktlint" version "6.3.0"
}
and
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.org.jlleitschuh.gradle:ktlint-gradle:6.3.0"
}
}
apply plugin: "org.jlleitschuh.gradle.ktlint"
Also I tried to apply it in multiple gradle files (root file and module files). I keep getting following error:
Unable to load class 'org.gradle.api.provider.SetProperty'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)</li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)</li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Any of solutions proposed by error didn’t help in any way.
Gradle wrapper version is 4.4 and gradle plugin version is 3.0.1. I am willing to provide any further required information.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Managing Android Multi-module Project with Gradle Plugin ...
In this post, I will introduce how we can make use of a custom Gradle plugin to help us manage Android project modules....
Read more >How to properly add gradle plugin to multiproject?
The reason this works is explained by the Gradle docs: For multi-project builds, the dependencies declared with a project's buildscript() method ...
Read more >Sharing Gradle Configuration in Multi-Module Android Projects
This post shows you a method of sharing common configuration between your Android Library modules in order to cut down on boilerplate Gradle...
Read more >Developing Custom Gradle Plugins
When the plugin is applied to a project, Gradle creates an instance of the plugin class and calls the instance's Plugin.apply() method. The...
Read more >Common modularization patterns - Android Developers
It's a central place to declare all your dependencies and is available to all the modules in a project. Use convention plugins to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, found the problem - https://docs.gradle.org/current/javadoc/org/gradle/api/provider/SetProperty.html - it is only available since Gradle 4.5
Possible solutions:
5.1.0
- this should work in your setup@JLLeitschuh I am tending not to fix this, but update minimal supported Gradle version. Also really need to do #148 that will run against lower supported and latest released Gradle versions to avoid such issues in the future.
Interesting stacktrace, I don’t see anything related to
ktlint-gradle
.In versions
6.x.x
we removed usages ofafterEvaluate {}
and this linejava.lang.ClassNotFoundException: com.android.ide.common.res2.ResourceSet
related to android plugin itself.