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