Build failed with an exception react native - android

while running react-native run-android I am getting below exception...
It was running fine and I made a git pull and did npm ci and after that, it is coming. There are no changes in the new pull also. In fact for after doing git colon that is also the same issue.
And it's running well in MAC.
Please help I am stuck.
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:13:5-33:19 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s
128 actionable tasks: 3 executed, 125 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
Thanks

I solved this
npm uninstall react-native-device-info
and then
npm install --save react-native-device-info
latest version should be 2.1.2

Add this to your app/build.gradle dependencies:
configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-gcm:16.1.0'
force 'com.google.android.gms:play-services-base:16.1.0'
force 'com.google.firebase:firebase-core:16.0.9'
force 'com.google.firebase:firebase-messaging:18.0.0'
}
}
This basically forces your third party libraries(like deviceinfo) that depend on gcm, to use the 16.1.0 version.

Related

Execution failed for task ':react-native-android-location-enabler:generateDebugRFile'

WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.5.3.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Task :react-native-android-location-enabler:generateDebugRFile FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
10 actionable tasks: 2 executed, 8 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-android-location-enabler:generateDebugRFile'.
Could not resolve all files for configuration ':react-native-android-location-enabler:debugRuntimeClasspath'.
Failed to transform react-native-0.63.2.aar (com.facebook.react:react-native:0.63.2) to match attributes {artifactType=android-symbol-with-package-name, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: D:\react\reactNative\GeoWheelDriver-master\node_modules\react-native\android\com\facebook\react\react-native\0.63.2\react-native-0.63.2.aar.
> Failed to transform 'D:\react\reactNative\GeoWheelDriver-master\node_modules\react-native\android\com\facebook\react\react-native\0.63.2\react-native-0.63.2.aar' using Jetifier. Reason: invalid entry size (expected 939924 but got 939159 bytes). (Run with --stacktrace for more details.)
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 15s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Try run yarn jetify
To migrate them to AndroidX? I really don't know. ๕๕๕
add this code to all projects { in android/build.gradle
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
Have a try with the below commands that might help you to resolve your issue with the react-native-android-location-enabler.
open Terminal
cd android
./gradlew clean
./graldew assembleRelease
The above commands will perform clean functionality for your Gradle and create a release build for you.
UPDATE
Try to remove your node_modules and install again.
Open Terminal
rm -rf node_modules
rm -rf yarn-lock.json
yarn install
If you are using npm as a package kindly use the required commands.

Error using library react-native-call-detection

I am trying to use the react-native-call-detection library to get the incoming call number.
But when I start the android emulator this low error appears.
I have already run react-native unlink react-native-call-detection, but the error continues. Having identify the other mistakes but to no avail!
If I completely remove react-native-call-detection then the emulator opens without any error.
Can someone help me please?
Thanks.
Microsoft Windows [versão 10.0.18363.535]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.
L:\wAPP\reactCall>react-native run-android
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-call-detection (to unlink run: "react-native unlink react-native-call-detection")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1645 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> Task :app:processDebugManifest FAILED
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
21 actionable tasks: 3 executed, 18 up-to-date
L:\wAPP\reactCall\android\app\src\debug\AndroidManifest.xml:11:7-34 Error:
Attribute application#allowBackup value=(false) from AndroidManifest.xml:11:7-34
is also present at [:react-native-call-detection] AndroidManifest.xml:14:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#allowBackup value=(false) from AndroidManifest.xml:11:7-34
is also present at [:react-native-call-detection] AndroidManifest.xml:14:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 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 7s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
L:\wAPP\reactCall\android\app\src\debug\AndroidManifest.xml:11:7-34 Error:
Attribute application#allowBackup value=(false) from AndroidManifest.xml:11:7-34
is also present at [:react-native-call-detection] AndroidManifest.xml:14:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#allowBackup value=(false) from AndroidManifest.xml:11:7-34
is also present at [:react-native-call-detection] AndroidManifest.xml:14:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 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 7s
at checkExecSyncError (child_process.js:610:11)
at execFileSync (child_process.js:628:15)
at runOnAllDevices (L:\wAPP\reactCall\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (L:\wAPP\reactCall\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at L:\wAPP\reactCall\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (L:\wAPP\reactCall\node_modules\#react-native-community\cli\build\index.js:164:9)
L:\wAPP\reactCall>
Try edit /android/app/main/AndroidManifest.xml in manifest tag at the top of the file add xmlns:tools="http://schemas.android.com/tools" before package name.
In application tag remove android:allowBackup="false" and add tools:replace="android:allowBackup"
And Don't forget require READ_PHONE_STATE permission by add <uses-permission android:name="android.permission.READ_PHONE_STATE" />

Error running run-android on react native

I am trying to run react native a project that was passed to me on android and is giving error
Already tried changing the gradle.properties file to use AndroidX but only gives another error, already tried changing the manifest file as the error fouls but also doesn't work
error image:
https://i.imgur.com/CUNHb7N.png
> Task :app:processDebugManifest FAILED
/home/leleuvilela/Workspace/waproject-base-app/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
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
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.CoreComponentFactopport-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.CoreCompo
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run wi
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s
132 actionable tasks: 122 executed, 10 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
You just need to add these two lines at the end of your {your app path}\android\gradle.properties file.
android.enableJetifier=true
android.useAndroidX=true

How can i open my rtmp stream on react-native

I want to show my rtmp stream in my react-native application but i can't do that. I tried 3-4 module and everyone gave me error. i can't even start my application.
i tried this firstly and i belive this module what i need but i can't use.
https://medium.com/#edisondevadoss/react-native-live-stream-rtmp-video-player-3db9d43c6137
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 875 file(s) to forward-jetify. Using 12 workers...
info JS server already running.
info Installing the app...
> Configure project :react-native-ksyvideo
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (25.0.0) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
> Task :app:processDebugManifest FAILED
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
20 actionable tasks: 2 executed, 18 up-to-date
C:\Users\AGAOGLU\reactnative\agd\android\app\src\debug\AndroidManifest.xml:11:7-34 Error:
Attribute application#allowBackup value=(false) from AndroidManifest.xml:11:7-34
is also present at [:react-native-ksyvideo] AndroidManifest.xml:19:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#allowBackup value=(false) from AndroidManifest.xml:11:7-34
is also present at [:react-native-ksyvideo] AndroidManifest.xml:19:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 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 4s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
C:\Users\AGAOGLU\reactnative\agd\android\app\src\debug\AndroidManifest.xml:11:7-34 Error:
Attribute application#allowBackup value=(false) from AndroidManifest.xml:11:7-34
is also present at [:react-native-ksyvideo] AndroidManifest.xml:19:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#allowBackup value=(false) from AndroidManifest.xml:11:7-34
is also present at [:react-native-ksyvideo] AndroidManifest.xml:19:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 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 4s
at checkExecSyncError (child_process.js:616:11)
at execFileSync (child_process.js:634:13)
at runOnAllDevices (C:\Users\AGAOGLU\reactnative\agd\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (C:\Users\AGAOGLU\reactnative\agd\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at then.result (C:\Users\AGAOGLU\reactnative\agd\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
i don't know what i should understand this error.

Native "Push" plugin for Ionic causes errors

I am trying to implement Push notifications in my ionic app. For this I want to use the native plugin push:
https://ionicframework.com/docs/native/push/
Before installing this plugin I can just start my app on my Android device using:
ionic cordova run android
The app starts up, and no errors occur. But after installing the Cordova/PhoneGap plugin like this:
ionic cordova plugin add phonegap-plugin-push
And this:
npm install --save #ionic-native/push
I can no longer run the app on my device because the build failes because of a bunch of errors.
BUILD FAILED
Total time: 22.02 secs
Error: cmd: Command failed with exit code 1 Error output:
D:\Data\njonkman\Desktop\kostendeclaratie_mobile - Copy\platforms\android\AndroidManifest.xml:28:13-35 Error:
Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:support-v13:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28
:13-35
is also present at [com.android.support:support-v13:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
This error has a suggestion: adding 'tools:replace="android:value"' to the eleemet in the AndroidManifest. I did that, after building again I get this error:
BUILD FAILED
Total time: 2.171 secs
> Exception while parsing the supplied manifest file D:\Data\njonkman\Desktop\kostendeclaratie_mobile - Copy\platforms\android\AndroidManifest.xml
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
[Fatal Error] :13:146: The prefix "tools" for attribute "tools:replace" associated with an element type "meta-data" is not bound.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Exception while parsing the supplied manifest file D:\Data\njonkman\Desktop\kostendeclaratie_mobile - Copy\platforms\android\AndroidManifest.xml
Another "solution" I found was to add this code piece:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
To the build.gradle file which fixes the first mentioned error but gives me another error (Push Plugin):
BUILD FAILED
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Total time: 12.765 secs
Error: cmd: Command failed with exit code 1 Error output:
D:\Data\njonkman\Desktop\kostendeclaratie_mobile - Copy\platforms\android\src\com\adobe\phonegap\push\FCMService.java:393: error: constructor Builder in class Bu
ilder cannot be applied to given types;
mBuilder = new NotificationCompat.Builder(context, channelID);
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
D:\Data\njonkman\Desktop\kostendeclaratie_mobile - Copy\platforms\android\src\com\adobe\phonegap\push\FCMService.java:403: error: constructor Builder in class Bu
ilder cannot be applied to given types;
mBuilder = new NotificationCompat.Builder(context, channelID);
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
I also tried to add this:
cordova.system.library.1=com.google.android.gms:play-services-auth:11.0.4
cordova.system.library.2=com.google.android.gms:play-services-identity:11.0.4
to the project.properties file, but yet another error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bint
ray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.0.1.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.547 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bint
ray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.0.1.
So I also tried to use 11.0.1 (instead of 11.0.4 which are both installed):
But it gives me this error:
BUILD FAILED
Total time: 14.349 secs
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
D:\Data\njonkman\Desktop\kostendeclaratie_mobile - Copy\platforms\android\src\com\adobe\phonegap\push\FCMService.java:393: error: constructor Builder in class Bu
ilder cannot be applied to given types;
mBuilder = new NotificationCompat.Builder(context, channelID);
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
D:\Data\njonkman\Desktop\kostendeclaratie_mobile - Copy\platforms\android\src\com\adobe\phonegap\push\FCMService.java:403: error: constructor Builder in class Bu
ilder cannot be applied to given types;
mBuilder = new NotificationCompat.Builder(context, channelID);
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
At this point I don't really have a clue to fix this, when I remove the plugin like this:
ionic cordova plugin remove phonegap-plugin-push
I can just start the app again with no problems or errors.
How can I make this plugin work?
Thanks in advance.
EDIT
So I created a new Ionic app with a boilerplate like this:
ionic start myApp tabs
And I installed the phonegap plugin push like this:
ionic cordova plugin add phonegap-plugin-push
And when using this:
ionic cordova run android
The app just starts with no errors, so it is my other project that is causing these issues. I used ionic info on the blank app which shows me this:
cli packages: (C:\Users\njonkman\AppData\Roaming\npm\node_modules)
#ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
#ionic/app-scripts : 3.1.6
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.9.2
System:
Node : v6.11.3
npm : 4.6.1
OS : Windows 10
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
So I did the same for my own app and it was showing some of the fields being outdated (or at least older than what the boilerplate had installed, also cordova) and I started updating the fields like this:
npm install -g cordova
And
npm install -g ionic
And
npm install #ionic/app-scripts#latest
But after running it again, I get one of the previous errors:
BUILD FAILED in 2s
(node:19208) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
D:\Data\njonkman\Desktop\kostendeclaratie_mobile - Copy (2)\platforms\android\app\src\main\AndroidManifest.xml:28:13-35 Error:
Attribute meta-data#android.support.VERSION#value value=(26.1.0) from [com.android.support:support-v13:26.1.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35 value=(25.4.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(26.1.0) from [com.android.support:support-v13:26.1.0] AndroidManifest.xml:28:
13-35
is also present at [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35 value=(25.4.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
At this point, wouldn't it be better to just re-create a new project, install all plugins that I need, test if they work and then add my logic/classes to it?
Thanks
EDIT
So I have "figured out" what is cousing the problems, I don't know why this happends or how to fix it yet. I am using 2 plugins that work fine alone but both installed, cause errors. These plugins are:
https://ionicframework.com/docs/native/file-path/
https://ionicframework.com/docs/native/push/
Ok, so I have managed to solve my problem. This is what I did:
I created a blank Ionic project ( ionic start blank ) to test if the plugin would work in a newly created project. It did. After that I installed all other plugins one by one to see if it still worked. At some point I came across the file-path plugin ( https://ionicframework.com/docs/native/file-path/ ). After installing this plugin I got the same errors as mentioned in the OP. After Googling(?) a bit I found this topic:
android getting Manifest merger failed error after update to new version of gradle
One of the solutions was adding this piece of code to the build.gradle file:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.1.0'
}
}
}
}
Note that I had already tried a similair solution but with a different version number ( 25.3.1 ). The error mentioned 2 versions, I picked the most recent one ( 26.1.0 ) in the solution, but I did not initially.
After trying it out on the blank project I tried it on my existing project. Just to be sure I removed the platform ( ionic cordova rm platform android ) and added it again ( ionic cordova add platform android ). Also note that I added the above piece to the build.gradle found in platforms>android>app and not in the build.gradle found inside platforms>android.
I can now run my project again with no errors.

Categories

Resources