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

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

问题描述

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

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.

然后我在Logcat中收到此错误:

Then I get this error in my Logcat:

清单合并失败

Manifest merger failed

我的app.gradle:

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'
}

我该如何解决?

我需要您的解决方案.

谢谢.

推荐答案

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

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

我添加

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

在我的AndroidManifest.xml

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

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

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

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

And add this in your gradle.properties file

android.useAndroidX=true
android.enableJetifier=true

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

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

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

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

出现上述错误

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

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

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

出现上述错误

添加implementation 'androidx.annotation:annotation:1.1.0'

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

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

编译版本目标版本应为 28.

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

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