React Native Android构建错误:清单合并失败:属性application @ appComponentFactory

时间:2019-06-18 15:20:47

标签: android react-native androidx manifest-merging

突然出现了这个构建错误(无处不在),该错误在早上运行良好。

我尝试启用AndroidX标志,但未找到ViewCompat类。所以我回滚了。自昨天以来,我没有进行任何更改,直到今天它都没有任何问题。

是因为这个release吗?

如果有人可以提供帮助,那就太好了。

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : 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:7:5-117 to override.


// package.json

"dependencies": {
    "accordion-collapse-react-native": "^0.1.9",
    "accounting-js": "^1.1.1",
    "appcenter": "2.0.0",
    "appcenter-analytics": "2.0.0",
    "appcenter-crashes": "2.0.0",
    "appcenter-push": "2.0.0",
    "axios": "^0.18.0",
    "fusioncharts": "^3.13.5",
    "immutability-helper": "^3.0.0",
    "lodash": "^4.17.11",
    "lottie-react-native": "^2.5.11",
    "moment": "^2.24.0",
    "react": "16.8.3",
    "react-native": "0.59.8",
    "react-native-app-link": "^1.0.0",
    "react-native-base64": "0.0.2",
    "react-native-camera": "^2.9.0",
    "react-native-charts-wrapper": "^0.5.1",
    "react-native-check-box": "^2.1.7",
    "react-native-code-push": "^5.6.0",
    "react-native-device-info": "^2.0.1",
    "react-native-elements": "^1.1.0",
    "react-native-gesture-handler": "^1.1.0",
    "react-native-keyboard-aware-scroll-view": "^0.8.0",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-modal": "^11.0.1",
    "react-native-orientation": "^3.1.3",
    "react-native-paper": "^2.15.0",
    "react-native-photo-upload": "^1.3.0",
    "react-native-picker-select": "^6.1.1",
    "react-native-select-input-ios": "^2.0.2",
    "react-native-svg": "^9.4.0",
    "react-native-svg-uri": "^1.2.3",
    "react-native-vector-icons": "^6.4.2",
    "react-native-webview": "^5.12.0",
    "react-navigation": "^3.8.1",
    "react-redux": "^6.0.1",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0"
},

dependencies {
    implementation project(':appcenter')
    implementation project(':appcenter-crashes')
    implementation project(':appcenter-analytics')
    implementation project(':react-native-orientation')
    implementation project(':react-native-webview')
    implementation project(':lottie-react-native')
    implementation project(':appcenter-push')
    implementation project(':react-native-device-info')
    implementation project(':react-native-fs')
    implementation project(':react-native-image-resizer')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-camera')
    implementation project(':react-native-code-push')
    implementation project(':react-native-svg')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-vector-icons')
    implementation 'com.facebook.fresco:animated-gif:1.10.0'


    implementation "com.google.android.gms:play-services-base:16.0.1"
    implementation ("com.google.firebase:firebase-core:16.0.6")

    implementation('com.google.firebase:firebase-messaging:17.3.4')

    implementation ('com.google.firebase:firebase-iid:17.0.4') {
        force = true
    }

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules


}

1 个答案:

答案 0 :(得分:4)

今天早上我也遇到了同样的问题。

我通过将react-native-app-authreact-native-device-info更新到最新版本来解决了这个问题。

npm install react-native-app-auth && npm install react-native-device-info

OR

yarn add react-native-app-auth && yarn add react-native-device-info

无需更新到AndroidX。