question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cant find ktlintApplyToIdea task

See original GitHub issue

I’ve added ktLint to my project like so:

Android Studio 3.2.1 At the top of my module level (app) build.gradle file:

plugins {
    id "org.jlleitschuh.gradle.ktlint" version "6.1.0"
}

I wan’t to generate the code styles for my project using ktlintApplyToIdea but I can’t find the task. Running ./gradlew tasks | grep kt results only in the following:

ktlintFormat - Runs the ktlint formatter on all kotlin sources in this project. ktlintCheck - Runs ktlint on all kotlin sources in this project.

I believe I was last able to run ktlintApplyToIdea in version 5x.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
janakagaminicommented, Oct 14, 2018

Thank you @Tapchicoma this solved the problem!

Note for anyone else who encounters the same issue with Android Studio:

  1. plugins block should be below the buildscript block.
  2. You must add (as documented) subprojects as well to get the other ktlint tasks added to the app module.
subprojects {
    apply plugin: "org.jlleitschuh.gradle.ktlint" // Version should be inherited from parent
}
2reactions
Tapchicomacommented, Oct 13, 2018

You need to move:

plugins {
    id "org.jlleitschuh.gradle.ktlint" version "6.1.0"
}

to your project top build.gradle. This will automatically apply this plugin to all modules in the project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Task 'ktlintCheck' not found in project - Stack Overflow
I have a sample project. The build.gradle (project) is: // Top-level build file where you can add configuration options common to all ...
Read more >
11.0.0 - GitHub
Configuration should stay the same, so, if you don't configure tasks ... into plugin jar ### Fixed - Fix `ktlintApplyToIdea` task fails when...
Read more >
My Android project template - Nicola Corti
In this blog-post, I will walk you through the steps I do before starting an Android project and that you can find already...
Read more >
Trying to use ktlint in my Android app Just found out about
Those will generate the gradle tasks you can invoke locally or on CI to lint ... ktlint doesn't have a strong IDE integration,...
Read more >
Adding ktlint to Your Kotlin Project - goobar
Your browser can't play this video. ... use the Gradle tool window in IntelliJ or Android Studio to see if the tasks are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found