Coder Social home page Coder Social logo

Comments (7)

ganeshpadhayay avatar ganeshpadhayay commented on June 22, 2024 3

If anyone is still facing this issue, then please check the compatibility of Gradle version used in the project and the version of Gradle plugin which studio is using

from ktlint-gradle.

Tapchicoma avatar Tapchicoma commented on June 22, 2024 1

In your case you have applied ktlint plugin via plugins block, while project applies android gradle plugin using old-way via classpath. Such scenario seems not working as ktlint can't find expected classes from android plugin.

I've tried to apply ktlint via classpath to this project and it works.

from ktlint-gradle.

Tapchicoma avatar Tapchicoma commented on June 22, 2024

Support for Android gradle 3.x plugin is already merged into master, but new plugin version hasn't been released.

@JLLeitschuh will do soon a new plugin release.

from ktlint-gradle.

Egorand avatar Egorand commented on June 22, 2024

Great, thanks!

from ktlint-gradle.

JLLeitschuh avatar JLLeitschuh commented on June 22, 2024

This has just been published as version 3.0.0

from ktlint-gradle.

Egorand avatar Egorand commented on June 22, 2024

I tried it out and I seem to be getting a similar error:

Caused by: java.lang.NoClassDefFoundError: com/android/build/gradle/AppPlugin
        at org.jlleitschuh.gradle.ktlint.KtlintPlugin$addKtLintTasksToAndroidKotlinPlugin$1$1.execute(KtlintPlugin.kt:77)
        at org.jlleitschuh.gradle.ktlint.KtlintPlugin$addKtLintTasksToAndroidKotlinPlugin$1$1.execute(KtlintPlugin.kt:31)
        at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
        at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
        at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
        at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
        ... 153 more

Is my understanding correct that I should just add id "org.jlleitschuh.gradle.ktlint" version "3.0.0" to the plugins block in the top-level build.gradle when setting up an Android project?

from ktlint-gradle.

Egorand avatar Egorand commented on June 22, 2024

Oh right, that makes sense. The old way seems to work, thanks for the help!

from ktlint-gradle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.