【问题标题】:Grade build compile gives dependency error等级构建编译给出依赖错误
【发布时间】:2021-04-25 10:09:33
【问题描述】:

大家好,我在 kotlin 中使用 jetpack compose 制作了一个应用程序,但是当我运行该应用程序时,它给了我这个错误。

“任务':app:compileDebugKotlin'执行失败。

无法解析配置 ':app:kotlin-extension' 的所有文件。 找不到 androidx.compose.compiler:compiler:0.1.0-dev07。 在以下位置搜索: - https://dl.google.com/dl/android/maven2/androidx/compose/compiler/compiler/0.1.0-dev07/compiler-0.1.0-dev07.pom - https://jcenter.bintray.com/androidx/compose/compiler/compiler/0.1.0-dev07/compiler-0.1.0-dev07.pom - https://jitpack.io/androidx/compose/compiler/compiler/0.1.0-dev07/compiler-0.1.0-dev07.pom 要求: 项目:应用程序

可能的解决方案:

这是我的代码(build-gradle):

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.github.zsoltk.pokedex"
        minSdkVersion 21
        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
    }
    composeOptions {
        kotlinCompilerExtensionVersion "0.1.0-dev07"
    }
}

dependencies {

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation "androidx.lifecycle:lifecycle-livedata:2.3.1"
    implementation 'androidx.ui:ui-framework:0.1.0-dev07'
    implementation 'androidx.ui:ui-layout:0.1.0-dev07'
    implementation 'androidx.ui:ui-foundation:0.1.0-dev07'
    implementation 'androidx.ui:ui-material:0.1.0-dev07'
    implementation 'androidx.ui:ui-tooling:0.1.0-dev07'
    implementation 'com.github.zsoltk:compose-router:0.7.0'
    implementation "io.reactivex.rxjava2:rxjava:2.2.17"
    implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}
buildscript {
    ext.kotlin_version = "1.3.61"
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.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()
        maven { url 'https://jitpack.io' }
    }
}

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

对我需要做什么有任何想法吗?

【问题讨论】:

  • 您应该更新所有依赖项以使用最新的 1.0.0-beta05

标签: android kotlin androidx android-jetpack-compose


【解决方案1】:

添加它需要的依赖怎么样?

需要这个 Gradle 插件: https://mvnrepository.com/artifact/androidx.compose.compiler/compiler

这些是 Java 依赖项: https://mvnrepository.com/artifact/androidx.compose

implementation "androidx.compose:compose-compiler:0.1.0-dev17"

同时是dev17 而不是dev7

【讨论】:

  • 您好,我尝试添加该依赖项,我将所有内容更改为 dev17,但仍然给我错误
  • 您从不应用插件并且缺少一个build.gradle;因此:祝你好运。
  • 已经放了另一个 build.gradle。我添加了插件但不起作用
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-08-29
  • 2016-08-25
  • 2022-09-27
  • 2017-10-27
  • 2015-10-03
  • 2019-12-05
  • 1970-01-01
相关资源
最近更新 更多