首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >原因: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException:‘:app:调试器运行

原因: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException:‘:app:调试器运行
EN

Stack Overflow用户
提问于 2022-10-22 03:50:34
回答 1查看 740关注 0票数 2

我正试图通过升级到compose compiler 1.3.2来升级到kotlin 1.7.20,但是我一直在错误地说Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

我用的是安卓工作室海豚

如果我用compose compiler to 1.2.0恢复kotlin 1.7.0,那么它就能正常工作。

根级文件。

代码语言:javascript
运行
复制
buildscript {
    ext {
        compose_version = '1.3.2'
    }
    dependencies {
        classpath "com.google.dagger:hilt-android-gradle-plugin:2.42"
    }
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.3.0' apply false
    id 'com.android.library' version '7.3.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

应用级分级文件

代码语言:javascript
运行
复制
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'dagger.hilt.android.plugin'
    id 'kotlin-kapt'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.affinidi.cealcompose"
        minSdk 23
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = '11'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
    namespace 'com.affinidi.cealcompose'
}

dependencies {

    implementation 'androidx.core:core-ktx:1.9.0'
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
    implementation 'androidx.activity:activity-compose:1.6.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"

    //Splash screen
    implementation 'androidx.core:core-splashscreen:1.0.0'

    //Leak Canary
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'

    //Compose Navigation
    implementation("androidx.navigation:navigation-compose:2.5.2")

    //Hilt
    implementation("com.google.dagger:hilt-android:2.43")
    kapt("com.google.dagger:hilt-compiler:2.43")
//    implementation "androidx.fragment:fragment-ktx:1.5.1"
//    implementation "androidx.activity:activity-ktx:1.5.1"

    //Hilt Navigation
    implementation("androidx.hilt:hilt-navigation:1.0.0")

    //Accompanist
    implementation("com.google.accompanist:accompanist-pager:0.25.0")
    implementation("com.google.accompanist:accompanist-systemuicontroller:0.25.0")

}

不知道到底出了什么问题。我正在为所有的依赖项和插件使用最新的lib,但是继续获取错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-22 06:31:58

Compose编译器和其他组合依赖项具有。目前:

代码语言:javascript
运行
复制
compose_compiler = '1.3.2'         
compose_version = '1.2.1'

在您的build gradle文件中,您对所有这些文件都使用相同的版本,而其中一些并不存在。

您可以很容易地在build.gradle脚本中使用不同的版本。

类似于:

代码语言:javascript
运行
复制
buildscript {
    ext {
        compose_compiler = '1.3.2'.         //compiler
        compose_version = '1.2.1'.          //stable compose dependencies
        compose_material3 = '1.0.0-rc01'    //M3 releases
    }
    //...
}

然后在你的app/build.gradle文件中

代码语言:javascript
运行
复制
composeOptions {
    kotlinCompilerExtensionVersion compose_compiler
}

dependencies {
   //stable releases
   implementation "androidx.compose.material:material:$compose_version"
   implementation "androidx.compose.ui:ui:$compose_version"
   //...other dipendencies

   //material3 releases
   implementation "androidx.compose.material3:material3:$compose_material3"
}
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74160942

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档