14

I have got above error after generating build in ionic3 I have tried a lot of solution but not working tell me, anyone, how to fix above error? below I have to include //Project-properties file. I have tried below solution but did not work for me :

  1. Android: Getting "Manifest merger failed" error after updating to a new version of gradle
  2. https://forum.ionicframework.com/t/solved-ionic-run-android-com-android-support-conflicting-v26-alpha1-and-v25-3-1/91826/19

//Project-properties file
target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.razorpay:checkout:1.4.6
cordova.system.library.2=com.android.support:support-v4:24.1.1+
cordova.system.library.3=com.google.firebase:firebase-core:+
cordova.system.library.4=com.google.firebase:firebase-messaging:+
cordova.gradle.include.1=cordova-plugin-fcm/app-FCMPlugin.gradle
cordova.system.library.5=com.android.support:support-v4:25.+
cordova.system.library.6=com.android.support:appcompat-v7:25.+
cordova.system.library.7=com.android.support:support-v4:24.1.1+
cordova.gradle.include.2=phonegap-plugin-barcodescanner/app-barcodescanner.gradle
cordova.system.library.8=com.squareup.okhttp3:okhttp:3+
Kapil Soni
  • 1,003
  • 2
  • 15
  • 37

4 Answers4

60

This solution worked for me

1- In the CordovaLib folder and in the build.gradle file, change the position of the Maven up

Repositories {
   maven {
         url "https://maven.google.com"
   }
   jcenter()
}

2- In the general build.gradle file of the project change the position of Maven up and add google()

Repositories {
   maven {
         url "https://maven.google.com"
   }
   google()
   jcenter()
}

3- In the build.gradle file of the APP folder change the position of Maven up and add google()

buildscript {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        google()
        mavenCentral()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        google()
        mavenCentral();
        jcenter()
    }
}

4 - Finally, run the "Make Project" that is in the upper corner of Android Studio. View the image here

  • Had same issue with cordova project build - setting maven repository as the first entry in the \platforms\android\build.gradle file was sufficient for me. – Chilledflame Jan 04 '19 at 16:39
  • Resolved issue in my libgdx project as welll using this approach. – Jimmy May 20 '19 at 15:12
  • @Danielly Queiroz sorry, but where's the "In the build.gradle file of the APP" ? i can find only 2 build-gradle files: one inside "CordovaLib" folder and one inside "android" folder (we're using ionic 1) – Simone Campagna Jul 01 '19 at 10:14
  • @SimoneCampagna Sorry, but my approach was tested using ionic 3 – Danielly Queiroz Aug 01 '19 at 20:12
  • @DaniellyQueiroz doesn't matter :) Your solution IMHO is OK but half solution in our build scenario: but i repeat is correct! So many thanks :) – Simone Campagna Aug 02 '19 at 13:18
  • This worked for me in an Appache/Cordova project. There were slight differences but I could see what to do. – user1036944 Oct 29 '19 at 23:39
  • This also worked for me , but you have to explain how did you come up with this ? I compared the files you listed between two different projects and one had the same thing you wrote and the other had to be fixed. Why did this happen ? why are they different ? However thank you for your answer. – Lu Blue Jun 12 '20 at 13:51
7

I did the following :

ionic cordova platform remove android ionic cordova platform add android ionic build android

And it worked!

Nicolas
  • 71
  • 1
1

Thanks! Had the same issue with cordova project build--setting maven repository as the first entry in both \platforms\android\build.gradle and \platforms\build.gradle files.

LeeX
  • 11
  • 2
  • for me, it was: platforms/android/build.gradle; platforms/android/app/build.gradle; platforms/android/CordovaLib/build.gradle – Shmarkus Feb 18 '19 at 13:42
0

I changed the com.android.tools.build:gradle:3.2.1 in Top-level build file to the android studio itself version and it worked.

you can find the current studio version in Help - About.

Chenhe
  • 924
  • 8
  • 19