Android Studio 3无法构建我的项目

时间:2017-08-09 10:21:20

标签: java android kotlin

我正在使用Android Studio 3预览代码并构建一个android kotlin项目,但由于此错误,它似乎无法编译:

  

:java.lang.Exception:无法在10000毫秒内从守护程序获取响应

     

无法执行增量编译:无法连接到Kotlin   编译守护程序无法连接到kotlin守护程序。使用后备   策略。

Error:Failed to complete Gradle execution.

Cause:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

这是我的gradle构建文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.1.3-2'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha9'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$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
}


    apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.1'

    defaultConfig {
        applicationId "com.jr.app"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        buildConfigField "String", "DEMO_SERVER_URL", "https://demoserver.restlet.net/v1/"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.0.0'
    implementation 'com.android.support:design:26.0.0'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.android.support:support-v4:26.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.0'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0'
}

由于

2 个答案:

答案 0 :(得分:0)

也许你有同样的错误。 我解决了here

答案 1 :(得分:0)

尝试关闭android studio,删除.gradle,然后将其打开。我遇到了同样的问题,现在已经解决。