React-native-onesignal: manifestPlaceholders Initialization is Broken in Android

Created on 25 Sep 2018  Â·  7Comments  Â·  Source: OneSignal/react-native-onesignal

I have noticed that in the most recent version of the OneSignal react-native SDK, the old method of initializing on Android (placing the OneSignal app ID in build.gradle manifest placeholders) no longer appears to work.

We will be investigating this issue this week.

Maintenance Issue Possible Bug

Most helpful comment

The problem persist

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId ...
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode ...
        versionName ...

        // Enabling multidex support.
        multiDexEnabled true

        manifestPlaceholders = [
            onesignal_app_id: ...,
            onesignal_google_project_number: 'REMOTE'
        ]
    }
    ...
> Task :react-native-onesignal:processDebugAndroidTestManifest FAILED
/react-native-onesignal/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger8819906485659168097.xml Error:
    Attribute meta-data#onesignal_app_id@value at manifestMerger8819906485659168097.xml requires a placeholder substitution but no value for <onesignal_app_id> is provided.
/react-native-onesignal/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger8819906485659168097.xml Error:
    Attribute meta-data#onesignal_google_project_number@value at manifestMerger8819906485659168097.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.

getting-gradle-error-with-onesignal-in-android-studio
how-to-use-librarys-manifestplaceholders-in-the-app
nativescript-onesignal-fails-android-build

All 7 comments

When building for Android I’m getting these “requires a placeholder substitution” errors:

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

Does anyone have a temporary workaround for this?

I tried adding the following to build.gradle as suggested by the OneSignal Android SDK setup documentation, but this doesn’t seem to work either:

android {
   defaultConfig {
      manifestPlaceholders = [
          onesignal_app_id: 'PUT YOUR ONESIGNAL APP ID HERE',
          onesignal_google_project_number: 'REMOTE'
      ]
    }
 }

have any updates? seems i use appIdFromManifest this function, and only get the empty string

anyone could find a solution for this?

@BatDroid I'm not having this problem anymore, I think maybe one of the newer updates fixed the issue. However when I did have this issue a few months ago it would only happen when I built through Android Studio. The workaround was to just make builds through the terminal instead.

Closing due to no response. Feel free to reply if you wish to reopen

The problem persist

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId ...
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode ...
        versionName ...

        // Enabling multidex support.
        multiDexEnabled true

        manifestPlaceholders = [
            onesignal_app_id: ...,
            onesignal_google_project_number: 'REMOTE'
        ]
    }
    ...
> Task :react-native-onesignal:processDebugAndroidTestManifest FAILED
/react-native-onesignal/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger8819906485659168097.xml Error:
    Attribute meta-data#onesignal_app_id@value at manifestMerger8819906485659168097.xml requires a placeholder substitution but no value for <onesignal_app_id> is provided.
/react-native-onesignal/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger8819906485659168097.xml Error:
    Attribute meta-data#onesignal_google_project_number@value at manifestMerger8819906485659168097.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.

getting-gradle-error-with-onesignal-in-android-studio
how-to-use-librarys-manifestplaceholders-in-the-app
nativescript-onesignal-fails-android-build

@rochapablo , it looks like that solution worked for you. I will close this issue if that's okay with you. If you continue seeing issues, let me know and I will reopen

Summary:

I came across this problem in unrelated project, but I found a solution that works for me: disabling Gradle feature "Only sync the active variant". In Android Studio: File > Settings > Experimental > Gradle -> uncheck "Only sync the active variant" checkbox.

Was this page helpful?
0 / 5 - 0 ratings