React-native-onesignal: Google Play Services Library Error

Created on 27 May 2019  ·  8Comments  ·  Source: OneSignal/react-native-onesignal

Description:

Almost half of the registered devices are showing Google Play services library error in OneSignal Dashboard. I Referred to all the previous issues #322 and #525 and tried each and every step but still, the newly registered devices are showing Google Play Services library error and are not able to receive a notification.

I even tried to create a fresh new project and integrate OneSignal but still, I am facing the same error

image

Environment

OneSignal React-Native SDK: 3.2.12
React-native: 0.57.8

Steps Tried to solve

  1. Upgraded React-native OneSignal SDK
  2. #387 Add to the AndroidManifest.xml
  3. https://github.com/geektimecoil/react-native-onesignal/issues/525#issuecomment-392224930 Tried this method.
  4. Created a fresh new project using the latest React-native but still the same issue.
  5. Reinstalled Google Play services from Android Studio

Project Build.gradle

`// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 27
supportLibVersion = "27.1.1"
}
repositories {
google()
jcenter()
maven { // <-- THIS
url 'https://maven.google.com/' // <-- THIS
name 'Google' // <-- THIS
} // <-- THIS
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { // <-- THIS
url 'https://maven.google.com/' // <-- THIS
name 'Google' // <-- THIS
} // <-- THIS
}
}

task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
`

App Build.gradle

`apply plugin: "com.android.application"

import com.android.build.OutputFile

buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
}
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

project.ext.react = [
entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

def enableSeparateBuildPerCPUArchitecture = true

def enableProguardInReleaseBuilds = false

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
    applicationId "com.pokewreck.poketimer"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 14
    versionName "3.2.0"

}
    signingConfigs {
    release {
        if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
}

splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86"
    }
}
buildTypes {
    release {
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        signingConfig signingConfigs.release

    }
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a":1, "x86":2]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}

}

dependencies {
compile project(':react-native-add-calendar-event')
compile project(':react-native-splash-screen')
compile project(':react-native-billing')
compile project(':react-native-admob')
compile project(':react-native-onesignal')
compile project(':react-native-vector-icons')
compile project(':react-native-gesture-handler')
compile project(':react-native-code-push')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules

}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
`

Android Help Wanted

Most helpful comment

@sagarv1997 what issue did you have on your firebase project? I'm facing the same issue and so far I haven't found a solution.

All 8 comments

The Google Play Services Library error means that one of the libraries required for OneSignal was not correctly added during the setup process.

Please double check that you have correctly completed all the setups on our mobile SDK setup docs for the SDK you are using: https://documentation.onesignal.com/docs/mobile-sdk-setup

Also, make sure you are using the latest version of the Android Support Library in your app. It looks like you're using an older version.

You can turn on the setLogLevel method and send us a full log from the device getting this error if you need further assistance.

The Google Play Services Library error means that one of the libraries required for OneSignal was not correctly added during the setup process.

Please double check that you have correctly completed all the setups on our mobile SDK setup docs for the SDK you are using: https://documentation.onesignal.com/docs/mobile-sdk-setup

Also, make sure you are using the latest version of the Android Support Library in your app. It looks like you're using an older version.

You can turn on the setLogLevel method and send us a full log from the device getting this error if you need further assistance.

Thanks for the Help and Support, I found that the issue was with the firebase cloud settings!
Issue solved.

The Google Play Services Library error means that one of the libraries required for OneSignal was not correctly added during the setup process.

Please double check that you have correctly completed all the setups on our mobile SDK setup docs for the SDK you are using: https://documentation.onesignal.com/docs/mobile-sdk-setup

Also, make sure you are using the latest version of the Android Support Library in your app. It looks like you're using an older version.

You can turn on the setLogLevel method and send us a full log from the device getting this error if you need further assistance.

I am also facing same error on react native: 0.60.5 and react native onesignal: 3.3.2. I have followed all the steps mention in documentation. can you explain which google play services library required by the onesignal?

If you're still using 27, try upgrading to 28 @arfa123

@sagarv1997 what issue did you have on your firebase project? I'm facing the same issue and so far I haven't found a solution.

I’d like to know too @sagarv1997

The Google Play Services Library error means that one of the libraries required for OneSignal was not correctly added during the setup process.
Please double check that you have correctly completed all the setups on our mobile SDK setup docs for the SDK you are using: https://documentation.onesignal.com/docs/mobile-sdk-setup
Also, make sure you are using the latest version of the Android Support Library in your app. It looks like you're using an older version.
You can turn on the setLogLevel method and send us a full log from the device getting this error if you need further assistance.

Thanks for the Help and Support, I found that the issue was with the firebase cloud settings!
Issue solved.

Can you please let us know what change cleared the issue? @sagarv1997

bro,can you share solution please @sagarv1997
also did you find a solutions guys? @renanmav @faridsaud @parthanjaria

Was this page helpful?
0 / 5 - 0 ratings