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
    未经允许,不得转载

  • 相关阅读:
    Jquery 的offset与position方法
    HTML精确定位:scrollLeft,scrollWidth,clientWidth,offsetWidth之完全详解
    js中对日期进行加减
    EditPlus 换行
    constructor属性,valueOf(),toSTring
    浅谈C#增加that关键字
    ASP.NET Global.ascx 事件大全
    Javascript:scrollWidth,clientWidth,offsetWidth的区别
    jquery val() 返回值怎么转换成 javascript 日期类型
    微软宣布Entity Framework 5的性能有了显著提升
  • 原文地址:https://www.cnblogs.com/linkstar/p/flutter-upgrade-zhi-hou-chu-xianAttribute-applicat.html
Copyright © 2011-2022 走看看