8

Some time ago i upgraded android studio kotlin version from 1.6.21 to 1.7.0. Every time I open a view in the project automatically changes its version('org.jetbrains.kotlin.android') from 1.6.21 to 1.7.0. Because of this, the project gives an error. I don't have a problem trying it in intellij. libraries not updating automatically

 A problem occurred configuring root project 'dijital-kurye-android-app'.
 Could not resolve all artifacts for configuration ':classpath'.
 Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21.

 Required by:
     project :

  > The consumer was configured to find a runtime of a component compatible with Java 11, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0:
      - gradle70JavadocElements
      - gradle70RuntimeElements
      - gradle70SourcesElements
      - javadocElements
      - runtimeElements
      - sourcesElements
    All of them match the consumer attributes:
      - Variant 'gradle70JavadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
          - Unmatched attributes:
              - Provides documentation but the consumer didn't ask for it
              - Provides javadocs but the consumer didn't ask for it
              - Doesn't say anything about its target Java version (required compatibility with Java 11)
              - Doesn't say anything about its elements (required them packaged as a jar)
              - Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
              - Provides release status but the consumer didn't ask for it
      - Variant 'gradle70RuntimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
          - Unmatched attributes:
              - Provides a library but the consumer didn't ask for it
              - Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
              - Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
              - Provides release status but the consumer didn't ask for it
              - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
      - Variant 'gradle70SourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
          - Unmatched attributes:
              - Provides documentation but the consumer didn't ask for it
              - Provides sources but the consumer didn't ask for it
              - Doesn't say anything about its target Java version (required compatibility with Java 11)
              - Doesn't say anything about its elements (required them packaged as a jar)
              - Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
              - Provides release status but the consumer didn't ask for it
      - Variant 'javadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
          - Unmatched attributes:
              - Provides documentation but the consumer didn't ask for it
              - Provides javadocs but the consumer didn't ask for it
              - Doesn't say anything about its target Java version (required compatibility with Java 11)
              - Doesn't say anything about its elements (required them packaged as a jar)
              - Provides release status but the consumer didn't ask for it
      - Variant 'runtimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
          - Unmatched attributes:
              - Provides a library but the consumer didn't ask for it
              - Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
              - Provides release status but the consumer didn't ask for it
              - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
      - Variant 'sourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
          - Unmatched attributes:
              - Provides documentation but the consumer didn't ask for it
              - Provides sources but the consumer didn't ask for it
              - Doesn't say anything about its target Java version (required compatibility with Java 11)
              - Doesn't say anything about its elements (required them packaged as a jar)
              - Provides release status but the consumer didn't ask for it
    The following variants were also considered but didn't match the requested attributes:
      - Variant 'apiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
          - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
      - Variant 'gradle70ApiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
          - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
Mustafa Maden
  • 109
  • 1
  • 4

2 Answers2

1

org.jetbrains.kotlin.android is available from gradlePluginPortal() or mavenCentral().
Don't use version 1.6.21 and 1.7.0 at the same time, this is absurd and may cause issues.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
1

Make sure to upgrade gradle to the latest version.

You can follow this excellent description on how to do that here. I guess nowadays starting at step 2 is enough.

luckyhandler
  • 10,651
  • 3
  • 47
  • 64