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.

Confused about IntelliJ IDEA/Android Studio integration

See original GitHub issue

I have a plain and simple configuration setup. In the root of my AS project I have:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.3.70"
    repositories {
        google()
        jcenter()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0-beta02"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jlleitschuh.gradle:ktlint-gradle:9.2.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

subprojects {
    apply plugin: "org.jlleitschuh.gradle.ktlint"
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

apply plugin: "org.jlleitschuh.gradle.ktlint"

I would love if my project could now have a codestyle set in intelliJ that allows me to cmd + shift + L to reformat as per the ktlint rules.

Looking at the readme I’m confused:

It says:

IntelliJ Idea Only Plugin Note: This plugin is automatically applied by the main ktlint plugin.

This plugin just adds special tasks that can generate IntelliJ IDEA codestyle rules using ktlint.

Idea plugin simple setup For all gradle versions:

Use the same buildscript logic as above, but with this instead of the above suggested apply line.

apply plugin: “org.jlleitschuh.gradle.ktlint-idea”

  1. So it looks like for the IntelliJ plugin, I don’t have to do anything since it’s applied “by the main ktlint”. I’m not sure if this is a gradle plugin or is this an IntelliJ IDEA plugin. If I go to the IntelliJ Plugin marketplace, I don’t see anything about a plugin being installed

  2. If “This plugin is automatically applied by the main ktlint plugin.” then why does it say right below to " Use the same buildscript logic as above, but with this instead of the above suggested apply line.

apply plugin: “org.jlleitschuh.gradle.ktlint-idea”"

Appreciate any clarification here or on the readme that get’s me to my goal of cmd + shift + L to reformat as per the ktlint rules in my project, so that we can share via git in my teams project

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ColtonIdlecommented, Aug 24, 2021

@u-ways we moved to ktfmt. It’s based off of googles java formatter and so it inherits any fixes from there, which makes for more frequent releases + a supported intellij plugin was perfect for our team.

1reaction
Tapchicomacommented, Apr 23, 2020

@ColtonIdle sorry for a late reply.

Yep currently it is not possible. If linked ticket would be implemented - this should solve your issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntelliJ IDEA is the base for Android Studio, the new IDE for ...
We are happy to confirm that Android Studio, the new IDE for Android development that Google is developing in cooperation with JetBrains, ...
Read more >
Guide to Install and Setup IntelliJ IDEA for Android App ...
An IDE(Integrated Development Environment) is a complete application suite that provides services like writing and editing of source code, ...
Read more >
How do I install Android Studio into IntelliJ? - Stack Overflow
Android Studio is just an IDE with a custom compilation of IntelliJ plugins. You can install / activate any IntelliJ plugin in IntelliJ...
Read more >
What is the difference between IntelliJ Idea and Android Studio?
Android studio in addition to IDE has some additional features that make it easy to work with mobile development like push notification and...
Read more >
A Detailed Guide to Android IDEs: Android Studio & IntelliJ ...
Unlike Apple, which has one main IDE, Android has two front-runners and a couple less popular choices. The two leading competitors are Android ......
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