迁移到Gradle插件3.2.1

时间:2018-11-08 22:05:02

标签: android gradle kotlin

该项目之前使用的是gradle 4.3.1,现在已通过gradle插件3.2.1迁移到4.8.1

项目本身不使用任何Kotlin内容,但我一直收到此错误

Could not resolve all files for configuration ':module-sdk:lintClassPath'.
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71.
  Required by:
      project :sdk > com.android.tools.lint:lint-gradle:26.2.1
      project :sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools:sdk-common:26.2.1
      project :module-sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools.build:builder:3.2.1
      project :module-sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools.build:manifest-merger:26.2.1
      project :module-sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools.lint:lint:26.2.1
      project :module-sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools.lint:lint-gradle-api:26.2.1
      project :module-sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools.build:builder:3.2.1 > com.android.tools:common:26.2.1
      project :module-sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools.lint:lint:26.2.1 > com.android.tools.lint:lint-kotlin:26.2.1
      project :module-sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools.lint:lint-gradle-api:26.2.1 > com.android.tools.build:gradle-api:3.2.1
      project :module-sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools:sdk-common:26.2.1 > com.android.tools:sdklib:26.2.1 > com.android.tools:repository:26.2.1
      project :module-sdk > com.android.tools.lint:lint-gradle:26.2.1 > com.android.tools.lint:lint:26.2.1 > com.android.tools.lint:lint-checks:26.2.1 > com.android.tools.lint:lint-api:26.2.1

项目级别的build.gradle类似于

buildscript {
  ext.kotlin_version = '1.3.0'
  repositories {
    mavenLocal()
    jcenter()
    google()
  }

  dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  }
}

Linttool似乎找不到kotlin-stdlib-jdk8:1.2.71?

1 个答案:

答案 0 :(得分:0)

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

项目build.gradle中的上述行解决了该问题。