【问题标题】:how can i migrate a flutter project to androidx:Execution failed for task ':app:preDebugBuild'. > Android dependency 'androidx.versionedparcelable我如何将颤振项目迁移到 androidx:任务“:app:preDebugBuild”的执行失败。 > Android 依赖 'androidx.versionedparcelable
【发布时间】:2020-06-06 15:18:16
【问题描述】:

我在我的颤振项目中添加了一个地理定位器包,每当我运行时,我都会收到有关 androidx 兼容性和 任务 ':app:preDebugBuild' 执行失败。

Android 依赖 'androidx.versionedparcelable:versionedparcelable' 对于编译 (1.0.0) 和运行时 (1.1.0) 类路径有不同的版本。您应该通过 DependencyResolution 手动设置相同的版本 我在 android/gradle.properties 中添加了这个

android.useAndroidX=true
android.enableJetifier=true

我尝试更改构建版本,但它不起作用。我也尝试了github粘贴提出的一些解决方案

我在 android/build.gradle 的 buidscript 下添加了这个

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.1.1"
            }

            if (details.requested.group == 'androidx.core'
                    && !details.requested.name.contains('androidx') ) {
                details.useVersion "1.0.1"
            }
        }
    }
}

enter image description here所做的一切都没用

【问题讨论】:

    标签: android-studio gradle flutter package androidx


    【解决方案1】:

    有时我能找到答案。我只需要更新颤振 以及 buildscript 下的 android/build.gradle 中的以下内容

    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'androidx.core' &&
                        !details.requested.name.contains('androidx')) {
                    details.useVersion "1.0.1"
                }
            }
        }
    }
    

    并在 android/gradle.properties 文件中添加以下内容

    android.useAndroidX=true
    android.enableJetifier=true 
    

    【讨论】:

      猜你喜欢
      • 2020-02-28
      • 2019-08-15
      • 1970-01-01
      • 2021-11-01
      • 2022-07-29
      • 2019-04-08
      • 1970-01-01
      • 1970-01-01
      • 2019-12-25
      相关资源
      最近更新 更多