Реактивная ошибка: сбой слияния - PullRequest
1 голос
/ 10 июля 2019

Запуск моего приложения получил эту ошибку:

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

1 Ответ

0 голосов
/ 11 июля 2019

Это означает, что одна из ваших библиотек использует AndroidX. Итак, вы должны конвертировать ваше приложение в AndroidX.

  • android.useAndroidX = true android.enableJetifier = true Поместите эти строки в свои gradle.properties.
  • npm install --save-dev jetifier
  • npx jetify
  • npx response-native run-android (ваше приложение должно корректно компилироваться и работать)
  • Вызовите npx jetify run в цели postinstall вашего package.json (Каждый раз, когда обновляются ваши зависимости, вы должны снова выпрямлять)
...