【问题标题】:Build Error in Android Studio Preview 4.1 Canary 10Android Studio Preview 4.1 Canary 10 中的构建错误
【发布时间】:2020-09-20 23:10:43
【问题描述】:

我正在尝试使用 Android Studio 4.1 Canary 10 开发应用程序,但每次它抛出构建失败。以下是错误。

任务“:app:generateDebugBuildConfig”执行失败。

无法获取 E:\example\exampleapp\app\build\generated\source\buildConfig\debug 的文件详细信息:无法归档属性 (errno 87)

build.gradle 文件

plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
}

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"

defaultConfig {
    applicationId "com.example.exampleapp"
    minSdkVersion 24
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}
buildFeatures {
    compose true
}

}

dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.ui:ui-framework:0.1.0-dev09'
implementation 'androidx.ui:ui-layout:0.1.0-dev09'
implementation 'androidx.ui:ui-material:0.1.0-dev09'
implementation 'androidx.ui:ui-tooling:0.1.0-dev09'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

类路径依赖:

  dependencies {
    classpath "com.android.tools.build:gradle:4.1.0-alpha10"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

我确实清理并重建了它没有帮助的项目。任何帮助都会很棒

谢谢

【问题讨论】:

  • Android 4.0 现已在稳定频道发布。您应该升级并重试
  • 我在谈论工作室预览@xaif
  • 用实际版本替换 $kotlin_version

标签: android android-studio build.gradle gradle-dependencies


【解决方案1】:

我无法重现主题问题。并且由于新手声誉得分 - 评论部分现在只读我的帐户。所以我发布答案。如果可能,请不要责备我。

尝试添加到应用程序build.gradle文件如下:

composeOptions {
        kotlinCompilerVersion "1.3.70-dev-withExperimentalGoogleExtensions-20200424"
        kotlinCompilerExtensionVersion "0.1.0-dev09"
    }

就在buildTypes { … } 块之前。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-14
    • 1970-01-01
    相关资源
    最近更新 更多