When I am running the command react-native run-android in the terminal
(React-Native), I am getting the below-mentioned error.
Manifest merger failed : Attribute application#appComponentFactory
value=(andr
oid.support.v4.app.CoreComponentFactory) from
[com.android.support:support-compa
t:28.0.0] AndroidManifest.xml:22:18-91 is also present at
[androidx.core:core:1.1.0-alpha05] AndroidManifest.xm
l:22:18-86 value=(androidx.core.app.CoreComponentFactory).
I tried migrating from android.support to android x as per the solution stated by few.
Expected Result: Build SuccessFul
Actual Result: BUILD FAILED in 9s
Can you try adding below in gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
It will automatically resolve dependency conflicts between google's files and third-party dependencies.
see Manifest merger failed after import a module if this option doesnt work rather than upgrading to android X now.
Related
I have an error with building my nativescript android app
I am using NativeScript 5.2 to develop an Android App. However one of my colleagues used NativeScript 6 to git push to the development branch. I pulled it and tns migrate and it can no longer be built. It keeps showing Command gradlew.bat failed with exit code 1.
I have tried upgrading my NativeScript to his version, and I've also tried reverting the NativeScript and git branch, but it still shows the same error.
error code:
Gradle build...
+ setting applicationId
+ applying user-defined configuration from C:\Users\Le\Documents\Work\work-app-investor\app\App_Resources\Android\app.gradle
+ using support library version 28.0.0
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-background-http\platforms\android\nativescript_background_http.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-camera\platforms\android\nativescript_camera.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-fingerprint-auth\platforms\android\nativescript_fingerprint_auth.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-loading-indicator\platforms\android\nativescript_loading_indicator.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-material-textfield\platforms\android\nativescript_material_textfield.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-pager\platforms\android\nativescript_pager.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-plugin-firebase\platforms\android\firebase-release.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-plugin-firebase\platforms\android\nativescript_plugin_firebase.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-material-core\platforms\android\nativescript_material_core.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
C:\Users\Le\Documents\Work\work-app-investor\platforms\android\app\src\main\AndroidManifest.xml:22:18-91 Error:
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.1.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:25:2-47:16 to override.
FAILURE: Build failed with an exception.
* 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.1.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:25:2-47:16 to override.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Unable to apply changes on device: 8DQCIF45VCSOTOYH. Error is: Command gradlew.bat failed with exit code 1.
You should start by checking your plugins for AndroidX support - you seem to have a few, based on your build messages.
Usually you will just need to update them in your package.json, do a tns platform clean android and build again.
I find an error when run the project, I try to look for many examples but fail all, this is the detail of error:
D:\myApp\android\app\src\debug\AndroidManifest.xml:22:18-91 Error:
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.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
> Task :app:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* 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.
Please anyone help me to solve this problem.
Thanks
So I faced this issue while installing react-native-reanimated in order to make react-navigation-drawer working.
The fix was:
Add to android/gradle.properties:
android.enableJetifier=true
android.useAndroidX=true
yarn add jetifier
In android directory run:
./gradlew clean
Run:
yarn jetify
react-native run-android
My RN version 0.59.8
Upgrading 'react-native-device-info' to version 2.1.2 fixed the error for me.
See http://github.com/facebook/react-native/issues/25294#issuecomment-503024749
I had some more libraries(other than deviceinfo) that depended on gcm so I used this to fix the issue: https://stackoverflow.com/a/56648987/8306924
finally found a solution after 2days and just added below two lines to android/build.gradle
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.3.4"
You just have to edit "gradle.properties" and add:
android.useAndroidX=true
android.enableJetifier=true
So you resolved the dependency conflicts between google and third party dependencies.
I downgraded java version from 17 to 15 and it works
i had the same issue and changed version of gradle on android > build.gradle and fixed my problem
classpath("com.android.tools.build:gradle:4.2.2")
to
classpath("com.android.tools.build:gradle:7.1.1")
clean gradle and build again
in android directory command prompt:
#gradlew clean
#gradlew build
The solution to the Execution failed for task :app:processDebugMainManifest’ in React Native Android project for JDK 16, 17, and above is to add the following line in the ./android/gradle.properties file in your project:
org.gradle.jvmargs=--add-opens java.base/java.io=ALL-UNNAMED
I'm trying to build a React Native Android application following an upgrade to RN 0.59.9, but I'm getting an error related to AndroidX.
I've tried many things including removing most native packages, changing AndroidManifest.xml and various other solutions mentioned on the internet but nothing seems to work.
My error is this:
> Task :app:processReleaseManifest FAILED
....\android\app\src\main\AndroidManifest.xml:22:18-91 Error:
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:35:2-108:16 to override.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
FAILURE: Build failed with an exception.
As I understand it means one of the package uses AndroidX but not the main app, however as far as I can tell nothing in my app uses AndroidX, and I made sure to upgrade to RN 0.59, not 0.60. I've even tried to grep "androidx" and remove all the packages that might mention it.
I've also tried to add "android.useAndroidX=true / android.enableJetifier=true" to gradle.properties just to see what happens but as expected many modules don't build since they have not been upgraded to AndroidX.
Any idea how to fix this bug?
This is most likely due to Android releasing all AndroidX libraries, and '+'-style gradle dependencies leaking in.
You can either ./gradlew :app:dependencies|grep androidx to find the problem libraries and then use gradle resolutionStrategies or android/build.gradle ext{} versioning to pin the Google library dependency, or you can convert your react-native project to androidx and use the jetifier tool via npm i jetifier && npx jetify so that non-androidx react-native libraries work.
Either should result in a working build as the react-native ecosystem transitions to AndroidX
Working with a React Native project and ready for release but running into this error:
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.
Works fine before adding the "react-native-admob" module through npm using "npm i --save react-native-admob#next"
In order to complete the project I need admob running! help please!
You are having this issue because your dependencies are depending on android support libaries. some have the older version named eg. 'com.android.support..', while some depend on the newer androidX library with names 'androidx.core....'. Having both com.android.support and androidx libaries in the same project will prevent the app from building.
This issue likely arose from the June 17 update to google play services which included major breaking changes to android support libraries. https://developers.google.com/android/guides/releases.
To fix this issue, identify all yr react-native packages and check if they have dependencies (listed under the play services release notes) that have been forceably updated to the newest version which gives androidx. If you have the android folder in the project that holds your build.gradles, try cd android, and then run ./gradlew app:dependencies --scan. This generates a unique link to a report for you to inspect each packages' dependencies. Expand your dependencies and make sure react-native packages when fully expanded do not contain any androidx file. Check all paths, testCompileClasspath, testRuntimeClassPath....
If you do have affected dependencies, you will need to force those packages to use the older version with com.android.support. This issue link has several suggestions on how to implement. https://github.com/facebook/react-native/issues/25292
I fixed this issue happening with our builds couple days back by doing stuff similar to this in my app/build.gradle:
implementation(project(':react-native-camera')){
exclude group: 'com.google.android.gms'
}
You might also need to declare some top-level configuration to force google play service and firebase to use specific version.
The official documention on androidx recommends people to switch to using the newer library androidx, and tell you to enable androidX and Jettifier to true. This DOES NOT work 100% for react-native libraries. So don't upgrade packages to androidx until you are sure all dependencies you have in your project are eligible for the migration to androidx.
I just imported an Android project(which was written in Eclipse) to Android Studio. At first, I had some problems so I deleted some dependencies and later when I reimported the project to Android Studio
I had to include the dependencies which I earlier deleted. I tried to run the app and I got the following messages.
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute activity#com.google.android.gms.ads.AdActivity#configChanges value=(keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|locale) from AndroidManifest.xml
is also present at [com.google.android.gms:play-services-ads-lite:9.4.0] AndroidManifest.xml value=(keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize).
Suggestion: add 'tools:replace="android:configChanges"' to <activity> element at AndroidManifest.xml to override.
Error:orientation|screenLayout|uiMode|screenSize|smallestScreenSize)
Error:orientation|screenLayout|uiMode|screenSize|smallestScreenSize|locale) from AndroidManifest.xml
What am I doing wrong?