Android Material 和 appcompat Manifest 合并在 react-native 或 ExpoKit 中失败 [英] Android Material and appcompat Manifest merger failed in react-native or ExpoKit

查看:20
本文介绍了Android Material 和 appcompat Manifest 合并在 react-native 或 ExpoKit 中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 'android.support:appcompat-v7' 更新为 28.0.0.

但它带来了构建错误.

属性 application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91也存在于 [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).建议:将 'tools:replace="android:appComponentFactory"' 添加到 <application>AndroidManifest.xml:8:5-23:19 中的元素进行覆盖.

然后我的 Logcat 中出现此错误:

<块引用>

清单合并失败

我的 app.gradle:

 配置.all {resolutionStrategy.force 'com.android.support:design:28.0.0'resolutionStrategy.force com.android.support:support-v4:28.0.0"resolutionStrategy.force com.android.support:support-media-compat:28.0.0"}...依赖{实现 'com.android.support:multidex:1.0.1'//我们的依赖实施 'com.android.support:appcompat-v7:28.0.0'实施 'com.android.support:appcompat-v7:28.0.0'}

我该如何解决?

我需要你的解决方案.

提前谢谢你.

解决方案

我通过参考@MehulSolanki 的答案通过搜索找到了解决方案.

我加了

tools:replace="android:appComponentFactory"android:appComponentFactory="whateverString"

在我的 AndroidManifest.xml

并更新 com.android.tools.build:gradl:

依赖项{类路径'com.android.tools.build:gradle:3.2.1'}

并将其添加到您的 gradle.properties 文件中

android.useAndroidX=trueandroid.enableJetifier=true

<块引用>

错误:[TAG] 无法解析变量${animal.sniffer.version}"

错误:[TAG] 无法解析变量${junit.version}"

如果出现上述错误

  1. 文件 -> 使缓存无效/重新启动
  2. 构建 -> 清理项目

<块引用>

错误:包 android.support.annotation 不存在错误:找不到符号类 Nullable

如果出现上述错误

添加实现'androidx.annotation:annotation:1.1.0'

更改 import android.support.annotation.Nullable; => androidx.annotation.Nullable;

更改 import android.support.annotation.NonNull; => androidx.annotation.NonNull;

<块引用>

编译版本目标版本应该是28.

I updated 'android.support:appcompat-v7' to 28.0.0.

But it brought an error from the build.

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 <application> element at AndroidManifest.xml:8:5-23:19 to override.

Then I get this error in my Logcat:

Manifest merger failed

my app.gradle:

  configurations.all {
    resolutionStrategy.force 'com.android.support:design:28.0.0'
    resolutionStrategy.force "com.android.support:support-v4:28.0.0"
    resolutionStrategy.force "com.android.support:support-media-compat:28.0.0"
  }
...
dependencies {
  implementation 'com.android.support:multidex:1.0.1'

  // Our dependencies
  implementation 'com.android.support:appcompat-v7:28.0.0'


  implementation 'com.android.support:appcompat-v7:28.0.0'
}

how do I fix it?

I need your solutions.

Thank you in advance.

解决方案

I found a solution through my search by referring to @MehulSolanki answer.

I add

tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"

in my on AndroidManifest.xml

and update com.android.tools.build:gradl:

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
  }

And add this in your gradle.properties file

android.useAndroidX=true
android.enableJetifier=true

ERROR: [TAG] Failed to resolve variable '${animal.sniffer.version}'

ERROR: [TAG] Failed to resolve variable '${junit.version}'

In case of above error

  1. File -> Invalidate Caches / restart
  2. Build -> Clean project

error: package android.support.annotation does not exist error: cannot find symbol class Nullable

In case of above error

Add implementation 'androidx.annotation:annotation:1.1.0'

change import android.support.annotation.Nullable; => androidx.annotation.Nullable;

change import android.support.annotation.NonNull; => androidx.annotation.NonNull;

Compile version and target version should be 28.

这篇关于Android Material 和 appcompat Manifest 合并在 react-native 或 ExpoKit 中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆