0

我是 android 开发新手,刚刚按照本教程在 android studio 3.2 ( canary ) 中创建了我的第一个“hello world”项目。https://developer.android.com/jetpack/docs/getting-started

然后我只是做了 Build-> make project project 尝试构建并给了我以下错误。

无法为 org.gradle.api.Project 类型的根项目“JetpackHelloWorld”获取未知属性“archLifecycleVersion”。

但我能够在我发布的问题的答案的帮助下解决该错误。 android jetpack 项目给出 archlifecycleversion 构建错误

解决该错误后,我尝试再次构建,现在出现以下错误。

带有目录目标的 '-d' 选项被忽略,因为指定了 '-Xbuild-file'

更新

Build.gradle(应用文件夹级别)

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.touseef.jetpackhelloworld"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

build.gradle(项目级别)

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

buildscript {
ext.kotlin_version = '1.2.41'
repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
    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
}

运行被禁用

正如您在屏幕截图中看到的那样,应用程序的运行选项被禁用,如果我单击下拉菜单,它会要求我编辑配置,我应该在空项目中进行哪些配置?

运行禁用

4

2 回答 2

0

由于某种原因,问题是在 Kotlin 编译器的设置中激活了增量编译。如果您禁用这些选项 - 您将不会收到警告。

于 2019-04-23T18:56:53.703 回答
0

Kotlin我在使用version构建项目时遇到了同样的问题1.2.61,它在将版本更新为1.2.71from后工作1.2.61

类路径依赖项是(在项目级别内build.gradle):

dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha10'
        classpath 'com.google.gms:google-services:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71"
        classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha06"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:1.2.71"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
于 2018-10-31T12:58:37.423 回答