Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Up Ktlint #3

Open
realityexpander opened this issue Oct 27, 2022 · 1 comment
Open

Setting Up Ktlint #3

realityexpander opened this issue Oct 27, 2022 · 1 comment

Comments

@realityexpander
Copy link
Owner

    I tried to setup KtLint, but getting this error and I have tried to fix it but with no success.
./gradlew ktlintFormat --info                                                                                                                                                                                                                                                   1 ↵  2776  18:01:47  
Initialized native services in: /Users/chrisathanas/.gradle/native
Initialized jansi services in: /Users/chrisathanas/.gradle/native
Found daemon DaemonInfo{pid=416, address=[53ce7f2d-2ced-46a8-ba4f-2fcf555d144d port:59895, addresses:[/127.0.0.1]], state=Idle, lastBusy=1666912333197, context=DefaultDaemonContext[uid=3ec12283-0f61-4dc8-8645-fc43b1c61b3f,javaHome=/Applications/Android Studio Preview 2022.1.1 Beta 3.app/Contents/jbr/Contents/Home,daemonRegistryDir=/Users/chrisathanas/.gradle/daemon,pid=416,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home,daemonRegistryDir=/Users/chrisathanas/.gradle/daemon,pid=1751,idleTimeout=null,priority=NORMAL,daemonOpts=-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=3ec12283-0f61-4dc8-8645-fc43b1c61b3f,javaHome=/Applications/Android Studio Preview 2022.1.1 Beta 3.app/Contents/jbr/Contents/Home,daemonRegistryDir=/Users/chrisathanas/.gradle/daemon,pid=416,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]

  Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 513). The daemon log file: /Users/chrisathanas/.gradle/daemon/7.5/daemon-513.out.log
Starting 4th build in daemon [uptime: 22 mins 21.209 secs, performance: 96%]
Using 10 worker leases.
Now considering [/Users/chrisathanas/Dropbox/Mac/Desktop/dev/Tasky] as hierarchies to watch
Watching the file system is configured to be enabled if available
File system watching is active
Starting Build
Settings evaluated using settings file '/Users/chrisathanas/Dropbox/Mac/Desktop/dev/Tasky/settings.gradle'.
Projects loaded. Root project using build file '/Users/chrisathanas/Dropbox/Mac/Desktop/dev/Tasky/build.gradle'.
Included projects: [root project 'Tasky', project ':app']
Invalidating in-memory cache of /Users/chrisathanas/.gradle/caches/journal-1/file-access.bin

> Configure project :
Evaluating root project 'Tasky' using build file '/Users/chrisathanas/Dropbox/Mac/Desktop/dev/Tasky/build.gradle'.
Invalidating in-memory cache of /Users/chrisathanas/.gradle/caches/7.5/fileHashes/fileHashes.bin
Invalidating in-memory cache of /Users/chrisathanas/.gradle/caches/7.5/fileHashes/resourceHashesCache.bin
Invalidating in-memory cache of /Users/chrisathanas/Dropbox/Mac/Desktop/dev/Tasky/.gradle/buildOutputCleanup/outputFiles.bin

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'Tasky'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:7.4.0-beta03.
     Required by:
         project : > com.android.application:com.android.application.gradle.plugin:7.4.0-beta03
         project : > com.android.library:com.android.library.gradle.plugin:7.4.0-beta03
      > No matching variant of com.android.tools.build:gradle:7.4.0-beta03 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
          - Variant 'apiElements' capability com.android.tools.build:gradle:7.4.0-beta03 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
          - Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.0-beta03 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
          - Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.0-beta03 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
          - Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.0-beta03 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Watched directory hierarchies: []

Originally posted by @realityexpander in #2 (comment)

@realityexpander
Copy link
Owner Author

Hm, I'm personally using the same AS version with the following Gradle and ktlint config which works just fine:

classpath 'com.android.tools.build:gradle:7.3.0'

plugins {
id "org.jlleitschuh.gradle.ktlint" version "11.0.0"
}
It doesn't require me to use Gradle 7.5 as you said, though 🤔
But it's also a project that was setup on an older AS version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant