не удалось построить проект Kotlin: не удалось разрешить все файлы для конфигурации - PullRequest
0 голосов
/ 08 сентября 2018

Я пытаюсь использовать Kotlin впервые в Android Studio. Я обновил Android Studio, но когда я попытался собрать проект, я получил сообщение об ошибке размещено ниже. Я попытался решить ее, следуя некоторым ответам, но они не смогли решить проблему.

Я попытался решить эту проблему, добавив следующую строку в зависимости:

        classpath "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

но это не могло решить.

пожалуйста, посмотрите на файл сборки, и, пожалуйста, дайте мне знать, как решить

встроенный ошибка :

org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration 
':classpath'.
Cause 1: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.jetbrains.kotlin:kotlin-reflect:1.2.61.

проект gradle :

buildscript {
ext.kotlin_version = '1.1.1'
repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

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

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

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

приложение Gradle :

apply plugin: 'com.android.application'

android {
compileSdkVersion 26

defaultConfig {
    applicationId "com.example.pc_amr.snakegame_01.app"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
}

buildTypes {
   release {
       minifyEnabled false
       proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
   }
}

}

dependencies {
implementation project(':feature')
implementation project(':base')
}

Обновление :

after adding that line to gradle.app:
    apply plugin: 'com.android.application'
i received the following error:

Unable to find method 'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)</li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)</li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

please note that, 
    ext.kotlin_version = '1.1.1'
and kotlin version in Android Studio is:
    version 1.2.61

Ответы [ 2 ]

0 голосов
/ 08 сентября 2018

Мне удалось ответить на вопрос, установив kotlin verion:

    ext.kotlin_version = '1.2.60'
0 голосов
/ 08 сентября 2018

Добавьте это поверх вашего build.gradle (приложение)

apply plugin: 'kotlin-android'

и установите ext.kotlin_version = '1.2.61' в проекте Gradle

...