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
未经允许,不得转载
- [Selenium] 针对下拉菜单出现之后又立马消失的问题,通过Javascript改变元素的可见属性
- Apache 在更改DocumentRoot,或新增虚拟目录之后出现403错误的解决方法汇总详解(Linux)
- 登录按钮点击之后本页出现一个小的页面,类似于弹窗
- Win10下用Anaconda安装TensorFlow 之后出现ImportError: No module named 'tensorflow'
- Chapter 3:处理原始文本—3.1 from urllib import urlopen 出现 cannot import name 'urlopen'及其他一些Python3新特性造成的改变
- java的JDBC连接mysql数据库时对于Datetime类型出现Cannot convert value '0000-00-00 00:00:00' from column 9 to TIMESTAMP
- 今天更新代码之后,突然出现一个问题:Tomcat启动时,总是会出现jvm fatal error错误导致tomcat无法正常启动,以下是错误信息:
- python中用pandas出现了OSError: Initializing from file failedw错误
- ionic splash screen 之后出现的白屏解决办法
- 前天图新鲜安装了IE7.0,之后VS2003出现问题,此url位于internet区域
- 使用dlsym时出现invalid conversion from void* to
- 【Linux】python 2.x 升级 python3.x 之后 yum命令出现except OSError, e: ^ SyntaxError: invalid syntax
- 启动tomcat出现Removing obsolete files from server... Could not clean server of obsolete ……错误
- 关于eclipse中android在创建之后R.java文件出现问题的解决办法
- 【Java】SVN下载maven项目到eclipse之后,项目红叉,pom.xml出现Missing artifact fakepath:dubbo:jar:2.8.5等缺少jar包情况
- No5-【原】hexo换主题之后可能出现的问题及解决办法
- .[Ext]引入“ext-lang-zh_CN.js”之后出现“未结束的字符串常量”
- 解决$.getJSON在IE浏览器下出现数据缓存,第一次访问某个后台路径之后,再次访问该路径不再走后台的方法。
- Myeclipse下删掉jar包之后出现感叹号或者在Libraries下面报错的处理方法
- 关闭Activity.finish()之后出现 Activity has leaked window that was originally added 错误