Could not find manifest-merger.jar (com.android.to

2020-06-09 08:22发布

问题:

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+

回答1:

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.



回答2:

I did the following :

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

And it worked!



回答3:

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.



回答4:

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.



回答5:

  1. npm update -g ionic (update ionic CLI)

  2. npm update -g cordova (update cordova CLI)

  3. ionic cordova platform rm android (Remove Platform)

  4. npm uninstall(remove Node module)

  5. npm install(add Node module)

  6. ionic cordova platform add android (add platform)

Then build command run:

ionic cordova build android If you want to run app in simulator then run Ionic cordova run android