zoukankan      html  css  js  c++  java
  • flutter upgrade之后出现Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from

    错误信息

    Initializing gradle...
    Resolving dependencies...
    Running Gradle task 'assembleDebug'...
    /Users/LinkinStar/flutterProject/xxxxxxxxx/android/app/src/debug/AndroidManifest.xml:22:18-91 Error:
    Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:11:5-34:19 to override.

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:processDebugManifest'. > Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:11:5-34:19 to override.

    我判断问题是由于AndroidX和Android support 共存导致

    在更新一些依赖之后出现

    Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.1) classpath. You should manually set the same version via DependencyResolution

    最终解决

    在build.gradle文件中添加

    中间subprojects这一段

    buildscript {
        repositories {
            google()
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
        }
    
        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"
                    }
                }
            }
        }
    }
    

      

    参考:https://github.com/flutter/flutter/issues/27254

    作者:LinkinStar
    未经允许,不得转载

  • 相关阅读:
    持续交付11-构建和部署的脚本化
    腾讯云即时通讯IM 公共整合
    腾讯云应用生成 UserSig
    「USACO 2020 US Open Platinum」Exercise
    async要点
    jQuery实现textarea高度根据内容自适应
    背景图片设置透明度而不改变内容
    input type=file实现图片上传,预览以及图片删除
    vant 字体图标不显示问题
    vue项目使用mock.js
  • 原文地址:https://www.cnblogs.com/linkstar/p/flutter-upgrade-zhi-hou-chu-xianAttribute-applicat.html
Copyright © 2011-2022 走看看