简体   繁体   English

Jetpack 组合材料 3 错误。 无法解析配置“:app:debugRuntimeClasspath”的所有文件

[英]Jetpack Compose Material 3 Error . Could not resolve all files for configuration ':app:debugRuntimeClasspath'

I have Two lines of error when i run the simple Jetpack Compose Material 3 Project运行简单的 Jetpack Compose Material 3 项目时出现两行错误

build.gradle(Project:) build.gradle(项目:)

    buildscript {
    ext {
        compose_version = '1.3.0-beta02'
        core_ktx_version = '1.9.0-rc01'
        material3_version = 'material3:1.3.0-beta02'
        lifecycle_version =  '2.4.1'
        activity_compose_version = '1.5.1'
        nav_version = "2.5.2"
        hilt_version = "2.42"
        hilt_nav_fragment = "1.0.0"
        lottieVersion = "5.2.0"
        timber_version = "5.0.1"
        hilt_navigation_compose = "1.0.0"
        room_version = "2.3.0-beta02"
        kotlin_version = "1.6.21"
    }
    dependencies {

        classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
        classpath "com.android.tools.build:gradle:4.2.1"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.2.2' apply false
    id 'com.android.library' version '7.2.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}

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

build.gradle (Module: ) build.gradle(模块:)

 plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'dagger.hilt.android.plugin'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.jetpackcompose.jp1"
        minSdk 24
        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_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {

    implementation "androidx.core:core-ktx:$core_ktx_version"
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material3:$material3_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
    implementation "androidx.activity:activity-compose:$activity_compose_version"

    implementation "androidx.compose.compiler:compiler:1.3.1"
    implementation 'androidx.appcompat:appcompat:1.6.0-beta01'
    // hilt -android
    implementation "com.google.dagger:hilt-android:$hilt_version"
    kapt "com.google.dagger:hilt-android-compiler:$hilt_version"

    // To Integrate Navigation
    implementation "androidx.navigation:navigation-compose:$nav_version"

    // To use additional extensions of navigation frameworks like hiltViewModel()
    implementation "androidx.hilt:hilt-navigation-fragment:$hilt_nav_fragment"
    implementation "androidx.hilt:hilt-navigation-compose:$hilt_navigation_compose"
    implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
    implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

    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"
 }

settings.gradle:设置。gradle:

    pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
        maven {
            url "https://maven.google.com"
        }
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url "https://maven.google.com"
        }
    }
}
rootProject.name = "jp1"
include ':app'

when i run the project i have an error of:当我运行项目时,出现以下错误:

Execution failed for task ':app:desugarDebugFileDependencies'.任务 ':app:desugarDebugFileDependencies' 执行失败。

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.无法解析配置“:app:debugRuntimeClasspath”的所有文件。 Could not find androidx.compose.material3:material3:1.3.0-beta02.找不到 androidx.compose.material3:material3:1.3.0-beta02。

Compose compiler and the other compose dependencies have different releases . Compose 编译器和其他 compose 依赖项有不同的版本
The version androidx.compose.compiler:compiler:1.3.0-beta02 doesn't exist.版本androidx.compose.compiler:compiler:1.3.0-beta02不存在。
You can check it in the google maven repo您可以在谷歌 maven 存储库中查看它

You can in any case use the stable version of the module compiler 1.3.1 and all the other compose dependencies at 1.2.1 or 1.3.0-beta02 :在任何情况下,您都可以使用模块编译器1.3.1的稳定版本以及1.2.11.3.0-beta02的所有其他组合依赖项:

buildscript {
    ext {
        compose_compiler = '1.3.1'         //compiler
        compose_version = '1.3.0-beta02'   //compose dependencies
        compose_material3 = '1.0.0-beta02' //material3 release
    }
    //...
}

and then:接着:

composeOptions {
    kotlinCompilerExtensionVersion compose_compiler
}

dependencies {
   // beta 1.3.0 releases
   implementation "androidx.compose.material:material:$compose_version"
   //... 

   //material3
   implementation "androidx.compose.material3:material3:$compose_material3"
}

As described in the documentation the compiler 1.3.x requires kotlin 1.7.10:文档中所述,编译器 1.3.x 需要 kotlin 1.7.10:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误重复“无法解析所有配置文件 ':app:debugRuntimeClasspath' - Error Repeated "Could not resolve all files for configuration ':app:debugRuntimeClasspath' #Kotlin 无法解析配置 ':app:debugRuntimeClasspath' 的所有文件 - #Kotlin Could not resolve all files for configuration ':app:debugRuntimeClasspath' $ArtifactResolveException: 无法解析配置 ':app:debugRuntimeClasspath' 的所有文件 - $ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath' 无法解析配置 ':app:debugRuntimeClasspath' / app:_agp_internal_javaPreCompileDebug_kaptClasspath' 的所有文件 - Could not resolve all files for configuration ':app:debugRuntimeClasspath' / app:_agp_internal_javaPreCompileDebug_kaptClasspath' android failed 无法解析配置':app:debugRuntimeClasspath'的所有依赖项 - android failed Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath' 我在构建同步时收到此错误“无法解析配置的所有依赖项 ':app:debugRuntimeClasspath' - I m getting this error while build sync "Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath' 错误“无法解析配置‘:app:debugCompileClasspath’的所有文件。” - error "Could not resolve all files for configuration ':app:debugCompileClasspath'." 尝试升级 gradle 并收到错误无法解析配置“:app:debugCompileClasspath”的所有文件 - try to upgrade gradle and getting error Could not resolve all files for configuration ':app:debugCompileClasspath' 无法解析配置 ':app:kotlin-extension' / Kotlin 的所有文件 - Could not resolve all files for configuration ':app:kotlin-extension' / Kotlin 无法解析配置“:app:prereleaseCompileClasspath”的所有工件 - Could not resolve all artifacts for configuration ':app:prereleaseCompileClasspath'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM