Onesignal-android-sdk: Manifest merger failed with multiple errors

Created on 4 Jan 2019  Â·  9Comments  Â·  Source: OneSignal/OneSignal-Android-SDK

Description:
Im adding onesignal to Whatsapp sticker app
I tried with new project. it is working fine
but when i trying to add in Whastapp sticker app it showing error

Error Log is here

Merging Errors: Error: Attribute meta-data#onesignal_app_id@value at AndroidManifest.xml requires a placeholder substitution but no value for <onesignal_app_id> is provided. app main manifest (this file)

 Error: Attribute meta-data#onesignal_google_project_number@value at AndroidManifest.xml requires a placeholder substitution but no value for <onesignal_google_project_number> is provided. app main manifest (this file) 

Using gradle :3.2.1

Here is the App level Gradle

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
    maven { url 'https://maven.google.com' }
}



apply plugin: 'com.android.application'

android {
    //the compression of webp file during build causes problem with FileDescriptor in ContentProvider.
    aaptOptions {
        noCompress "webp"
    }
    compileSdkVersion 28
    defaultConfig {

        applicationId "com.antelu.pro"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        def contentProviderAuthority = applicationId + ".stickercontentprovider"
        //ones
        manifestPlaceholders = [
                onesignal_app_id: '51b99042-2041-4eb5-afc5-e94b5db99e1a',
                onesignal_google_project_number: 'REMOTE']
        // Creates a placeholder property to use in the manifest.
        manifestPlaceholders =
                [contentProviderAuthority: contentProviderAuthority]
        // Adds a new field for the authority to the BuildConfig class.
        buildConfigField("String",
                "CONTENT_PROVIDER_AUTHORITY",
                "\"${contentProviderAuthority}\"")



    }
    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

task checkDebug {
    doLast {
        println("checkDebug")
        if (android.defaultConfig.applicationId.startsWith("com.whatsapp")) {
            throw new GradleException("applicationId in defaultConfig cannot start with com.whatsapp, please change your applicationId in app/build.gradle");
        }
        checkApplicationIdInDebug()
    }
}

private void checkApplicationIdInDebug() {
    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    def ignoreApplicationIdCheck = properties.getProperty('ignoreApplicationIdCheck')
    if (ignoreApplicationIdCheck == null) {
        if (android.defaultConfig.applicationId.equals("com.example.samplestickerapp")) {
            throw new GradleException("Your applicationId is currently com.example.samplestickerapp, please change your applicationId to a different string in app/build.gradle in line 16");
        }
    } else {
        println("application id check ignored")
    }
}


task checkRelease {
    doLast {
        println("checkRelease")
        if (android.defaultConfig.applicationId.startsWith("com.example")) {
            throw new GradleException("applicationId in defaultConfig cannot start with com.example, please change your applicationId in app/build.gradle");
        }
    }
}

tasks.whenTaskAdded { task ->
    println(task.name)
    if (task.name.contains("assembleDebug")) {
        task.dependsOn checkDebug
    }
    if (task.name.contains("assembleRelease")) {
        task.dependsOn checkRelease
    }
}


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'

    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-auth:11.6.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.facebook.fresco:fresco:1.11.0'
    implementation 'com.facebook.fresco:webpsupport:1.11.0'
    implementation 'com.facebook.fresco:animated-webp:1.11.0'

    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
}

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

Most helpful comment

@varundeva @DevenRathod2
You need to merge both manifestPlaceholders into a single assignment since they are overriding each other.

Change the following

        manifestPlaceholders = [
                onesignal_app_id: '51b99042-2041-4eb5-afc5-e94b5db99e1a',
                onesignal_google_project_number: 'REMOTE']
        // Creates a placeholder property to use in the manifest.
        manifestPlaceholders =
                [contentProviderAuthority: contentProviderAuthority]

Into

        manifestPlaceholders = [
                onesignal_app_id: '51b99042-2041-4eb5-afc5-e94b5db99e1a',
                onesignal_google_project_number: 'REMOTE',
                contentProviderAuthority: contentProviderAuthority
        ]

Thanks.

All 9 comments

Same Problem Here If you fix it Please help me

Hope for the reply from company
4days ago
They are not responding
And solutions are not available anywhere

I'm using onesignal for WhatsApp Sticker App

On Mon 7 Jan, 2019, 11:35 PM DevenRathod2 <[email protected] wrote:

Same Problem Here If you fix it Please help me

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/OneSignal/OneSignal-Android-SDK/issues/696#issuecomment-452025733,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AX8BPTQIqvPjGxOyYhHPiuqOEy3_7UiGks5vA4xhgaJpZM4Zpudj
.

@varundeva @DevenRathod2
You need to merge both manifestPlaceholders into a single assignment since they are overriding each other.

Change the following

        manifestPlaceholders = [
                onesignal_app_id: '51b99042-2041-4eb5-afc5-e94b5db99e1a',
                onesignal_google_project_number: 'REMOTE']
        // Creates a placeholder property to use in the manifest.
        manifestPlaceholders =
                [contentProviderAuthority: contentProviderAuthority]

Into

        manifestPlaceholders = [
                onesignal_app_id: '51b99042-2041-4eb5-afc5-e94b5db99e1a',
                onesignal_google_project_number: 'REMOTE',
                contentProviderAuthority: contentProviderAuthority
        ]

Thanks.

Thanks
Solved

I try many method and finally i fix all issues and now i cant use onesignal push notification on my whatsapp sticker app
Change the following

manifestPlaceholders = [ onesignal_app_id: '51b99042-2041-4eb5-afc5-e94b5db99e1a', onesignal_google_project_number: 'REMOTE'] // Creates a placeholder property to use in the manifest. manifestPlaceholders = [contentProviderAuthority: contentProviderAuthority]

Into This

manifestPlaceholders = [ onesignal_app_id: '626f9699-7c17-4ab7-8e5b-c6ed7453f80e', onesignal_google_project_number: 'REMOTE', contentProviderAuthority: contentProviderAuthority] // Adds a new field for the authority to the BuildConfig class. buildConfigField("String", "CONTENT_PROVIDER_AUTHORITY", "\"${contentProviderAuthority}\"")

And after this you can able to push notifaction via OneSignal

Executing tasks: [:app:assembleDebug] in project C:\Users\Quality computer\Downloads\Compressed\WhatsAppClone-master

Task :app:preBuild UP-TO-DATE
Task :app:preDebugBuild UP-TO-DATE
Task :app:compileDebugAidl NO-SOURCE
Task :app:generateDebugBuildConfig UP-TO-DATE
Task :app:compileDebugRenderscript NO-SOURCE
Task :app:javaPreCompileDebug UP-TO-DATE
Task :app:generateDebugResValues UP-TO-DATE
Task :app:generateDebugResources UP-TO-DATE
Task :app:processDebugGoogleServices UP-TO-DATE
Task :app:mergeDebugResources UP-TO-DATE
Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
Task :app:extractDeepLinksDebug UP-TO-DATE

Task :app:processDebugManifest FAILED
C:\Users\Quality computer\Downloads\Compressed\WhatsAppClone-masterapp\src\main\AndroidManifest.xml Error:
Attribute meta-data#onesignal_app_id@value at AndroidManifest.xml requires a placeholder substitution but no value for is provided.
C:\Users\Quality computer\Downloads\Compressed\WhatsAppClone-masterapp\src\main\AndroidManifest.xml Error:
Attribute meta-data#onesignal_google_project_number@value at AndroidManifest.xml requires a placeholder substitution but no value for is provided.

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 with multiple errors, see logs

  • 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 865ms
8 actionable tasks: 1 executed, 7 up-to-date

can someone help me?

can someone help me?

i guess you did not add you
in gradle (app level module)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pedrofurtado picture pedrofurtado  Â·  5Comments

mohsinnaqvi110 picture mohsinnaqvi110  Â·  4Comments

ibnabdelfatah picture ibnabdelfatah  Â·  4Comments

sannyo picture sannyo  Â·  7Comments

joelfernandes19 picture joelfernandes19  Â·  6Comments