【问题标题】:The Gradle failure AndroidX incompatibilities in this Flutter app这个 Flutter 应用程序中的 Gradle 失败 AndroidX 不兼容
【发布时间】:2020-04-08 11:49:58
【问题描述】:

当我尝试在 Android 模拟器上运行我的 Flutter 应用程序时出现此错误,我使用的是 MacBook 和 VSCode,该应用程序在 ios 模拟器上运行良好。

*** What went wrong:                                                      
Execution failed for task ':app:preDebugBuild'.                         
> Android dependency 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' is set to compileOnly/provided which is not supported**

**These are my build.gradle dependcies:**



 dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.2'
    }

在 gradle.properties 中,这就是我所拥有的一切:

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true

在我的应用级别 build.gradle 中:

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.multidex:multidex:2.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.androidx.support.test:runner:1.1.0'
    androidTestImplementation 'com.androidx.support.test.espresso:espresso-core:3.1.0'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'
}

【问题讨论】:

  • 能否提供异常的完整堆栈跟踪?

标签: android gradle flutter androidx


【解决方案1】:

我认为这是版本冲突。只需按以下方式更改您的 gradle 和 kotlin 版本即可解决此问题。

// change kotlin_version above 1.3.0 like 1.3.31
// change build gradle version from 3.2.1 to 3.3.2
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31"

我想这可能会对你有所帮助。

【讨论】:

    猜你喜欢
    • 2019-08-17
    • 2019-11-07
    • 1970-01-01
    • 2020-05-03
    • 1970-01-01
    • 2021-07-10
    • 2021-06-24
    • 2021-07-13
    • 2020-08-11
    相关资源
    最近更新 更多