简体   繁体   中英

Error: Manifest merger failed with multiple errors, see logs

After trying to install OneSignal's SDK on my Android project, I noticed a consistently happening error when compiling, that prevents me to start using this service.

My build.grade(Module:app) file:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "com.sourcey.project"
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    // maven central repository
    mavenCentral()

    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.microsoft.azure:azure-mobile-android:3.1.0'
    compile 'com.microsoft.azure.android:azure-storage-android:0.6.0@aar'
    compile 'com.android.support:design:24.2.1'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.miguelcatalan:materialsearchview:1.4.0'
    compile 'com.afollestad.material-dialogs:core:0.9.1.0'
    compile 'com.afollestad.material-dialogs:commons:0.9.1.0'

    **compile 'com.onesignal:OneSignal:3.+@aar'
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.google.android.gms:play-services-location:10.0.1'
    compile 'com.google.android.gms:play-services-analytics:10.0.1'**
//Without including these 4 rows, the project building process goes perfectly.


    testCompile 'junit:junit:4.12'
}


apply plugin: 'com.google.gms.google-services'

Thanks for your help guys!

Fix: Forgot to add-

  manifestPlaceholders = [onesignal_app_id: "PUT YOUR ONESIGNAL APP ID HERE",
                              // Project number pulled from dashboard, local value is ignored.
                              onesignal_google_project_number: "REMOTE"]

observe the lines that contain ** and make the necessary changes and To do with below:

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId 'com.edesonabizerril.newintercampi'
        **manifestPlaceholders = [onesignal_app_id: "000000000-b000-4d1e-0000-00000000000000",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]**
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 13
        multiDexEnabled false
        versionName '1.10'
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.google.firebase:firebase-database:12.0.1'
    ...

    **implementation 'com.onesignal:OneSignal:3.+@aar'**

    testImplementation 'junit:junit:4.12'

}
apply plugin: 'com.google.gms.google-services'

inside your dependencies section you have this:

   **compile 'com.onesignal:OneSignal:3.+@aar'

that will cause the problem when you sincronize your project.

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.microsoft.azure:azure-mobile-android:3.1.0'
    compile 'com.microsoft.azure.android:azure-storage-android:0.6.0@aar'
    compile 'com.android.support:design:24.2.1'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.miguelcatalan:materialsearchview:1.4.0'
    compile 'com.afollestad.material-dialogs:core:0.9.1.0'
    compile 'com.afollestad.material-dialogs:commons:0.9.1.0'

    **compile 'com.onesignal:OneSignal:3.+@aar'
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.google.android.gms:play-services-location:10.0.1'
    compile 'com.google.android.gms:play-services-analytics:10.0.1'**
//Without including these 4 rows, the project building process goes perfectly.


    testCompile 'junit:junit:4.12'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM