d02*_*pak 27 android manifest android-studio
使用Google所谓的Material Design 2.0需要您添加
implementation 'com.google.android.material:material:1.0.0-rc01'
Run Code Online (Sandbox Code Playgroud)
在应用程序Gradle中也包括
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
Run Code Online (Sandbox Code Playgroud)
这显示了冲突
这是日志所说的内容
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0-rc02] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0-rc01] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.
Run Code Online (Sandbox Code Playgroud)
即使在将其添加到Manifest之后,它也显示Manifest Merger因多次错误而失败
Pra*_*ani 24
如今,此错误很常见:
当我们遇到这种类型的错误时:更新库并提供对AndroidX的使用,但我们正在使用旧的。
您可以按照以下步骤解决此问题:
在Android Studio 3.2及更高版本中,您可以通过从菜单栏中选择“重构”>“迁移到AndroidX”来快速迁移现有项目以使用AndroidX。
注意:要迁移不使用任何第三方库且依赖项需要转换的现有项目,可以将
android.useAndroidX标志设置 为true,将android.enableJetifier标志设置为false。
此步骤将自动完成所有答案都表示手动执行的所有操作
即使您遇到任何其他错误,例如运行时构建失败,也可以:
要么
希望对所有人有帮助。谢谢。
Tom*_* C. 11
要解决此问题,您必须添加工具名称空间并将建议的属性应用于IDE推荐的应用程序元素。
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="your.package.uri">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:appComponentFactory"
android:appComponentFactory="androidx">
Run Code Online (Sandbox Code Playgroud)
在build.gradle文件中用androidx替换所有android依赖项.
例如:
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'androidx.annotation:annotation:1.0.0'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
Run Code Online (Sandbox Code Playgroud)
建议:
tools:replace="android:appComponentFactory"在元素AndroidManifest.xml:5:5-19:19 处添加' ' 以覆盖。
如果您添加了tools:replace="android:appComponentFactory",但通过修复仍遇到问题,请创建一个新项目,将代码和相同的依赖项粘贴到其中。在那之后,我希望它应该被修复。
如果仍不能解决问题,请尝试添加以下两个:
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"
Run Code Online (Sandbox Code Playgroud)
在AndroidManifest.xml> <application标签中。
| 归档时间: |
|
| 查看次数: |
41321 次 |
| 最近记录: |