React-native-onesignal: Android debug build fails with manifest merge failure

Created on 5 Jul 2018  ·  14Comments  ·  Source: OneSignal/react-native-onesignal

Description:

Simple project with firebase and detox installed. Added react-native-onesignal and now Android Studio can't build for debug due to manifest merge failures that seem to be caused by the one signal project. Release builds work fine. I tried adding placeholder values to defaultConfig to no avail.

                manifestPlaceholders = [
                    onesignal_app_id: "aaaa-bbbb-cccc-dddd",
                    onesignal_google_project_number: "REMOTE"
                ]

Environment

"react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-firebase": "^4.2.0",
    "react-native-onesignal": "^3.2.5",

installed with npm.

Steps to Reproduce Issue:

  1. Create new react-native project
  2. Install react-native-firebase
  3. Install detox
  4. run ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug

Anything else:

Error:{REDACTED}/node_modules/react-native-onesignal/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger7557051756214117379.xml Error:
    Attribute meta-data#onesignal_app_id@value at manifestMerger7557051756214117379.xml requires a placeholder substitution but no value for <onesignal_app_id> is provided.
{REDACTED}/node_modules/react-native-onesignal/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger7557051756214117379.xml Error:
    Attribute meta-data#onesignal_google_project_number@value at manifestMerger7557051756214117379.xml requires a placeholder substitution but no value for <onesignal_google_project_number> is provided.
FAILURE: Build failed with an exception.
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-onesignal:processDebugAndroidTestManifest'.

BUILD FAILED in 10s

Most helpful comment

The solution that fixed it for me was to add:

subprojects {
    afterEvaluate { subproject ->
        if (subproject.name == 'react-native-onesignal') {
            android {
                defaultConfig {
// One Signal:
                    manifestPlaceholders = [onesignal_app_id               : "",
                                            onesignal_google_project_number: ""]
                }

            }
        }
    }
}

In android/build.gradle

All 14 comments

Hi @haswalt ,

We generally see manifest merger errors during the gradle build, but it actually shouldn't cause any further issues, you should still be able to build & run your project.

This error prevents the build from passing and therefore tests from running. It actually breaks a significant part of our workflow completely.

I can assemble release builds but not debug test builds

@haswalt I haven't seen this issue in quite a while and I assumed the Android OneSignal Native SDK must have fixed something. Currently I cannot reproduce this issue.

Can you copy and paste your app/build.gradle?

@Nightsd01 gist of app/build.gradle: https://gist.github.com/haswalt/610182d006677ab52ce04e288cd6f97c

Note the addition of the manifest placeholders for testing. Instructions don’t include adding them, but old ones did so figured I’d see if it fixed it. It didn’t

@haswalt Any progress on this issue, did you figure it out?

@adamczyk777 nope no progress. @Nightsd01 any help?

@haswalt Under the buildTypes section in your build.gradle can you try adding a debug section with the same contains as your release section?

        debug {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            defaultConfig {
                manifestPlaceholders = [
                    onesignal_app_id: "[REDACTED]",
                    onesignal_google_project_number: "REMOTE"
                ]
            }
        }

Any progress on this? This error comes up every time I try to make a debug build

I just replace with package com.geektime.rnonesignalandroid; at this file https://github.com/geektimecoil/react-native-onesignal/blob/master/android/src/androidTest/java/com/geektime/rnonesignalandroid/ApplicationTest.java .. and able to rebuild

Is anyone at OneSignal able to help with this issue? Not being able to create a debug build is blocking me.

I'm having a similar issue.
The weird thing is that it happens only when I add productFlavor.
Then it fails on this:
Task :react-native-onesignal:processDebugAndroidTestManifest FAILED
with the same error as mentioned above.
And this task doesn't even happen when there are not flavors included in the gradle.
please help!

@DoriDembinsky I think you hit the nail on the head. My build.gradle file uses productFlavor as well and I get the same failure to build when trying to run in the simulator. As soon as I comment out the productFlavor section it builds flawlessly.

The solution that fixed it for me was to add:

subprojects {
    afterEvaluate { subproject ->
        if (subproject.name == 'react-native-onesignal') {
            android {
                defaultConfig {
// One Signal:
                    manifestPlaceholders = [onesignal_app_id               : "",
                                            onesignal_google_project_number: ""]
                }

            }
        }
    }
}

In android/build.gradle

@DoriDembinsky and where exactly in android/build.gradle should I add subprojects code?

Was this page helpful?
0 / 5 - 0 ratings