繁体   English   中英

React-native错误:清单合并失败

[英]React-native error: Manifest merger failed

运行我的应用程序时出现此错误:

Manifest merger failed : Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86
        is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
        Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.

我试图添加到gradle.properties

android.useAndroidX=true
android.enableJetifier=true

并且(对于AndroidManifest)

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

还有(build.gradle)

implementation "androidx.appcompat:appcompat:1.0.0"

取代以前的

implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"

但不为我工作。

-Android Manifest.xml-

<uses-permission android:name="android.permission.INTERNET" />

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

-build.gradle-

dependencies {
    implementation project(':react-native-exit-app')
    implementation project(':react-native-firebase')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompatv7:
 ${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation "com.google.firebase:firebase-core:17.0.0"
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
}

这意味着您的一个库正在使用AndroidX。 因此,您必须将您的应用程序转换为AndroidX。

  • android.useAndroidX = true android.enableJetifier = true将这些行放入gradle.properties中。
  • npm install --save-dev jetifier
  • npx jetify
  • npx react-native run-android(您的应用程序应正确编译并运行)
  • 在package.json的postinstall目标中调用npx jetify run(每当依赖项更新时,您都必须再次进行jetify)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM