Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest merger fails when assembling Android test application #777

Closed
sonicdoe opened this issue Jun 12, 2019 · 15 comments · Fixed by #789
Closed

Manifest merger fails when assembling Android test application #777

sonicdoe opened this issue Jun 12, 2019 · 15 comments · Fixed by #789

Comments

@sonicdoe
Copy link
Contributor

Description

When assembling the Android test application using ./gradlew assembleAndroidTest, the manifest merger fails with the following errors:

> Task :react-native-onesignal:processDebugAndroidTestManifest FAILED
/…/react-native-onesignal/examples/RNOneSignal/node_modules/react-native-onesignal/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger8422387923641009676.xml Error:
        Attribute meta-data#onesignal_app_id@value at manifestMerger8422387923641009676.xml requires a placeholder substitution but no value for <onesignal_app_id> is provided.
/…/react-native-onesignal/examples/RNOneSignal/node_modules/react-native-onesignal/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger8422387923641009676.xml Error:
        Attribute meta-data#onesignal_google_project_number@value at manifestMerger8422387923641009676.xml requires a placeholder substitution but no value for <onesignal_google_project_number> is provided.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

A similar issue was reported with #579 in July 2018 and subsequently closed in January 2019 without any apparent resolution.

Environment

The example project at examples/RNOneSignal@31b5242 which uses react-native-onesignal v3.2.14.

Steps to reproduce

  1. git clone https://github.com/geektimecoil/react-native-onesignal.git
  2. cd react-native-onesignal
  3. git checkout 31b52420c807c22405e70b44800e20f3a8e3456e
  4. cd examples/RNOneSignal
  5. yarn
  6. cd android
  7. ./gradlew assembleAndroidTest
@wkoutre
Copy link
Contributor

wkoutre commented Jun 14, 2019

Running into this, as well.

@wkoutre
Copy link
Contributor

wkoutre commented Jun 14, 2019

@sonicdoe Are you using productFlavors? If so, you'll need to change the command like:

buildType = "debug"
productFlavor = "dev"

./gradlew assembleDevDebugAndroidTest

@sonicdoe
Copy link
Contributor Author

No, the example project at examples/RNOneSignal@31b5242 (which I’ve used to reproduce this) does not use product flavors.

@dorthwein
Copy link

dorthwein commented Jun 17, 2019

I'm running into this as well - a random google search showed this issue crosswalk-project/cordova-plugin-crosswalk-webview#207 which suggests using buildToolsVersion: 28.0.0.

We already do this, but then I noticed a warning during build

OneSignalPlugin: WARNING: OneSignalPlugin: Downgraded 'com.android.support:28.0.0' -> 27.+ to prevent compile errors! Recommend updating your project's compileSdkVersion!

where this project is forcing it to downgrade ;(

@wkoutre
Copy link
Contributor

wkoutre commented Jun 17, 2019

My personal issue was resolved when I built using the proper task-name after the gradlew command (described above).

FWIW, here is part of my android/build.gradle file:

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion '28.0.3'
            }
        }
    }
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "28.0.0"
            }
        }
    }
}

@rgomezp
Copy link
Contributor

rgomezp commented Jun 17, 2019

Thanks for your patience while we investigate the issue.

@rgomezp rgomezp added this to Backlog in React Native OneSignal Main via automation Jun 26, 2019
@rgomezp rgomezp moved this from Backlog to In Progress in React Native OneSignal Main Jun 26, 2019
@rgomezp
Copy link
Contributor

rgomezp commented Jun 29, 2019

Howdy y'all,
We're not currently sure how to permanently fix this. In the meantime, you can run:
./gradlew app:assembleAndroidTest

We also realized we were running into issues with ./gradlew build so we are creating a PR that will fix this too.

Thanks for bringing this to our attention.

@sonicdoe
Copy link
Contributor Author

sonicdoe commented Jul 2, 2019

I was able to get assembleAndroidTest to work by injecting the manifest placeholders into react-native-onesignal itself (similar to #579 (comment)) and removing the ApplicationTest class in android/src/androidTest (which seems to have no effect anyway). See my gradle-android-test branch for all changes.

Unfortunately, I couldn’t get to the bottom of why this issue occurs and why these changes are necessary. As far as I could find out, androidTest resolves to a different dependency tree which is why the manifest merger behaves differently in that case.

@rgomezp Let me know if you have any more insight and whether the above changes would be okay. If so, I’d open a pull request.

@rgomezp
Copy link
Contributor

rgomezp commented Jul 2, 2019

@sonicdoe ,
Thanks for the fix @sonicdoe! Please create the PR

@mtt87
Copy link

mtt87 commented Jul 2, 2019

@rgomezp adding my question here since you closed the other ticket

is this directory necessary to be included in the npm package or can it only live in the GitHub repo?

Because if the answer is no, then this problem is solved for me.

I'm asking because I don't know what are good practices but I don't see other RN packages with this directory androidTest so I guess either nobody is testing or they don't include tests in the npm package?

@rgomezp
Copy link
Contributor

rgomezp commented Jul 2, 2019

@mtt87 ,
It isn't necessary. The original creators must have accidentally included it. We are removing it in the upcoming RN OneSignal SDK release. Thanks!

@mtt87
Copy link

mtt87 commented Jul 2, 2019

Fantastic 😄 Thank you

@rgomezp
Copy link
Contributor

rgomezp commented Jul 22, 2019

Howdy y'all,
We will be releasing the newest version of the react-native SDK with fixes very soon. If you would like to test the changes now, simply change your react-native-onesignal in your package.json to point to this repository.

"react-native-onesignal":"geektimecoil/react-native-onesignal"

Would love to hear your feedback prior to the release. Cheers!

EDIT: IGNORE THESE INSTRUCTIONS AS THE PLUGIN HAS BEEN PUSHED TO NPM

@sonicdoe
Copy link
Contributor Author

I see you’ve already released the newest version, v3.3.0. Should this release change anything about this issue? If I repeat the reproduction steps from the original post, I’m running into the exact same error.

@rgomezp
Copy link
Contributor

rgomezp commented Jul 23, 2019

@sonicdoe ,
Are you sure you reinstalled it correctly?

Edit: just tested. You are correct. My apologies here. I thought #791 fixed this. I will discuss with @jkasten2 regarding #789

React Native OneSignal Main automation moved this from In Progress to Done Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants