简体   繁体   English

Android Studio 3无法构建我的项目

[英]Android Studio 3 can't build my project

I am using Android Studio 3 preview to code and build a android kotlin project but it does not seem to compile due to this error: 我正在使用Android Studio 3预览代码并构建一个android kotlin项目,但由于此错误,它似乎无法编译:

: java.lang.Exception: Unable to get response from daemon in 10000 ms :java.lang.Exception:无法在10000毫秒内从守护程序获取响应

Could not perform incremental compilation: Could not connect to Kotlin compile daemon Could not connect to kotlin daemon. 无法执行增量编译:无法连接到Kotlin编译守护程序无法连接到kotlin守护程序。 Using fallback strategy. 使用后备策略。

 Error:Failed to complete Gradle execution. Cause: Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed) 

Here is my gradle build file 这是我的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'
}

Thanks 谢谢

Maybe you have the same error I had. 也许你有同样的错误。 I solved here 在这里解决

Try to close android studio, delete .gradle and then open it. 尝试关闭android studio,删除.gradle然后打开它。 I had the same problem and it's fixed now. 我有同样的问题,现在已经解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM