执行com.android.build.gradle.internal.tasks.MergeJavaResWorkAc



请帮助解决构建错误。

Kotlin版本:1.5.31渐变拉链:7.2渐变版本:7.0.3

任务":app:mergeDugJavaResource"的执行失败。

执行com.android.build.gradle.internal.tasks.MergeJavaResWorkAction时出错从输入中找到2个路径为"kotlin/internal/kotlin_builtins"的文件:/用户/Umut/.gradle/caches/transforms-3/98f5d2a243e47179d111ce52d349da0/transformed/jetified-kotlin-compiler-embeddable-1.5.31.jar/用户/Umut/.gradle/caches/transforms-3/3af4d33202657704115aebc723152cf8/transformed/jetified-kotlin-stdlib-1.5.31.jar添加packagingOptions块可能会有所帮助,请参阅https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html获取更多信息

plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
apply from: "$rootDir/ktlint.gradle"
android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
defaultConfig {
applicationId "com.umut.example"
minSdkVersion 26
targetSdkVersion 31
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
useIR = true
}
bundle {
//Generate APKs for devices with different screen densities//
density {
enableSplit true
}
//Generate APKs for devices with different CPU architectures//
abi {
enableSplit true
}
//Create a split APK for each language//
language {
enableSplit false
}
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LGPL2.1'
exclude("META-INF/*.kotlin_module")
}
}
kapt {
correctErrorTypes = true
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
//test
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
testImplementation "com.google.truth:truth:$truth_version"
testImplementation "io.mockk:mockk:$mockk_version"
testImplementation "org.robolectric:robolectric:$robolectric_version"
testImplementation "androidx.arch.core:core-testing:$archCoreTest_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlin_coroutines_version"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
//kotlin
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
//hilt
implementation "com.google.dagger:hilt-android:$dagger_hilt_version"
kapt("com.google.dagger:hilt-android-compiler:$dagger_hilt_version")
//retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:$retrofit_coroutines_adapter_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
implementation "com.squareup.moshi:moshi-kotlin:$moshi_version"
kapt("com.squareup.moshi:moshi-kotlin-codegen:$moshi_version")
// okHttp3
implementation "com.squareup.okhttp3:okhttp:$okHttp_version"
implementation "com.squareup.okhttp3:logging-interceptor:$okHttp_version"
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okHttp_version"
//compose
implementation "androidx.activity:activity-compose:$compose_activity_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$compose_view_model_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.animation:animation:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.constraintlayout:constraintlayout-compose:$constraintlayout_compose_version"
//3rd
implementation "androidx.multidex:multidex:$multidex_version"
implementation "com.airbnb.android:lottie-compose:$lottie_version"
implementation "com.pinterest:ktlint:$ktlint_version"
implementation "androidx.security:security-crypto:$security_crypto_version"
kapt "androidx.security:security-crypto-ktx:$security_crypto_version"
}
buildscript {
ext {
kotlin_version = '1.5.31'
security_crypto_version = "1.1.0-alpha03"
google_services_version = "4.3.10"
lifecycle_version = "2.4.0"
lifecycle_extensions_version = "2.2.0"
kotlin_coroutines_version = "1.5.2"
kotlin_serialization_version = "0.20.0"
compose_version = '1.0.5'
constraintlayout_compose_version = '1.0.0-rc02'
compose_activity_version = '1.4.0'
compose_view_model_version = '2.4.0'
okHttp_version = '4.9.2'
retrofit_version = '2.9.0'
moshi_version = '1.12.0'
dagger_hilt_version = '2.38.1'
retrofit_coroutines_adapter_version = '0.9.2'
lottie_version = '4.2.0'
truth_version = '1.1.3'
mockk_version = '1.12.1'
robolectric_version = '4.7.2'
archCoreTest_version = '2.1.0'
ktlint_version = "0.43.0"
multidex_version = "2.0.1"
}
repositories {
mavenCentral()
google()
maven { url "https://maven.google.com" }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.gms:google-services:$google_services_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$dagger_hilt_version"
}
}
allprojects {
repositories {
mavenCentral()
google()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

发生这种情况是因为以下依赖关系:

implementation "com.pinterest:ktlint:$ktlint_version"

ktlint不能作为依赖项添加。有关安装说明,请参阅官方文档。

相关内容

  • 没有找到相关文章

最新更新