title: One Signal Google Play Services Library Error React-Native
body: <p>I recently came across a problem with my app.</p>
  <p>I had installed OneSignal, it worked. And some updates after adding the onesignal, stopped working. I don't know exactly what I did wrong or which module is conflicting with the onesignal, I've been on this problem for days and I still can't solve it. Need help.</p>
  <p><a href="https://i.stack.imgur.com/hqwKk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hqwKk.png" alt="enter image description here" /></a></p>
  <p>My package.json:</p>
  <pre><code>{
    &quot;name&quot;: &quot;smartial&quot;,
    &quot;version&quot;: &quot;0.0.1&quot;,
    &quot;private&quot;: true,
    &quot;scripts&quot;: {
      &quot;android&quot;: &quot;react-native run-android&quot;,
      &quot;ios&quot;: &quot;react-native run-ios&quot;,
      &quot;start&quot;: &quot;react-native start&quot;,
      &quot;test&quot;: &quot;jest&quot;,
      &quot;lint&quot;: &quot;eslint .&quot;,
      &quot;android-linux&quot;: &quot;npx react-native run-android --terminal \&quot;$PWD/shkonsole\&quot;&quot;
    },
    &quot;dependencies&quot;: {
      &quot;@react-native-community/google-signin&quot;: &quot;^4.0.3&quot;,
      &quot;react-native-onesignal&quot;: &quot;^3.7.3&quot;,
      &quot;@sentry/react-native&quot;: &quot;^1.4.1&quot;,
      &quot;react-native-code-push&quot;: &quot;^6.2.1&quot;,
      &quot;react-native-google-places&quot;: &quot;^3.1.2&quot;,
      &quot;@react-native-community/datetimepicker&quot;: &quot;^2.4.2&quot;,
      &quot;@react-native-community/masked-view&quot;: &quot;^0.1.10&quot;,
      &quot;@react-navigation/material-bottom-tabs&quot;: &quot;^5.2.12&quot;,
      &quot;@react-navigation/native&quot;: &quot;^5.4.3&quot;,
      &quot;@react-navigation/stack&quot;: &quot;^5.4.0&quot;,
      &quot;react-native-gesture-handler&quot;: &quot;^1.6.1&quot;,
      &quot;native-base&quot;: &quot;^2.13.12&quot;,
      &quot;react-native-paper&quot;: &quot;^3.10.1&quot;,
      &quot;react-native-safe-area-context&quot;: &quot;^2.0.3&quot;,
      &quot;react-native-reanimated&quot;: &quot;^1.9.0&quot;,
      &quot;react-native-screens&quot;: &quot;^2.8.0&quot;,
      &quot;apisauce&quot;: &quot;^1.1.1&quot;,
      &quot;react-native-config&quot;: &quot;^1.2.1&quot;,
      &quot;react-native-easy-app&quot;: &quot;^1.7.3&quot;,
      &quot;react-native-vector-icons&quot;: &quot;^6.6.0&quot;,
      &quot;@thallyssonklein/border-layout-react-native&quot;: &quot;^1.0.14&quot;,
      &quot;recoil&quot;: &quot;github:eveningkid/Recoil#react-native&quot;,
      &quot;react&quot;: &quot;16.13.1&quot;,
      &quot;react-native&quot;: &quot;0.63.2&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@babel/core&quot;: &quot;^7.10.0&quot;,
      &quot;@babel/runtime&quot;: &quot;^7.10.0&quot;,
      &quot;@bam.tech/react-native-make&quot;: &quot;^3.0.0&quot;,
      &quot;@react-native-community/eslint-config&quot;: &quot;^1.1.0&quot;,
      &quot;babel-jest&quot;: &quot;^26.0.1&quot;,
      &quot;eslint&quot;: &quot;^7.1.0&quot;,
      &quot;jest&quot;: &quot;^26.0.1&quot;,
      &quot;metro-react-native-babel-preset&quot;: &quot;^0.59.0&quot;,
      &quot;react-test-renderer&quot;: &quot;16.11.0&quot;
    },
    &quot;jest&quot;: {
      &quot;preset&quot;: &quot;react-native&quot;
    }
  }
  </code></pre>
  <p>My android/build.gradle:</p>
  <pre><code>buildscript {
      ext {
          buildToolsVersion = &quot;28.0.3&quot;
          minSdkVersion = 16
          compileSdkVersion = 28
          targetSdkVersion = 28
          
          googlePlayServicesAuthVersion = &quot;16.0.1&quot;
      }
      repositories {
          google()
          jcenter()
      }
      dependencies {
          classpath('com.android.tools.build:gradle:3.6.3')
          classpath 'com.google.gms:google-services:4.1.0'
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          mavenLocal()
          maven {
              // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
              url(&quot;$rootDir/../node_modules/react-native/android&quot;)
          }
          maven {
              // Android JSC is installed from npm
              url(&quot;$rootDir/../node_modules/jsc-android/dist&quot;)
          }
  
          google()
          jcenter()
          maven { url 'https://www.jitpack.io' }
      }
  }
  </code></pre>
  <p>My android/app/build.gradle:</p>
  <pre><code>apply plugin: &quot;com.android.application&quot;
  
  import com.android.build.OutputFile
  
  project.ext.react = [
      enableHermes: false,  // clean and rebuild if changing
  ]
  
  apply from: &quot;../../node_modules/react-native/react.gradle&quot;
  
  def enableSeparateBuildPerCPUArchitecture = false
  
  def enableProguardInReleaseBuilds = false
  
  def jscFlavor = 'org.webkit:android-jsc:+'
  
  def enableHermes = project.ext.react.get(&quot;enableHermes&quot;, false);
  
  android {
      compileSdkVersion rootProject.ext.compileSdkVersion
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
      defaultConfig {
          applicationId &quot;com.smartial&quot;
          minSdkVersion rootProject.ext.minSdkVersion
          targetSdkVersion rootProject.ext.targetSdkVersion
          versionCode 24
          versionName &quot;3.0.9&quot;
          multiDexEnabled true
      }
      splits {
          abi {
              reset()
              enable enableSeparateBuildPerCPUArchitecture
              universalApk false  // If true, also generate a universal APK
              include &quot;armeabi-v7a&quot;, &quot;x86&quot;, &quot;arm64-v8a&quot;, &quot;x86_64&quot;
          }
      }
      signingConfigs {
          debug {
              storeFile file('debug.keystore')
              storePassword 'android'
              keyAlias 'androiddebugkey'
              keyPassword 'android'
          }
          release {
              storeFile file('smartial-app.jks')
              storePassword KEYSTORE_PASSWORD
              keyAlias KEY_ALIAS
              keyPassword KEY_PASSWORD
          }
      }
      buildTypes {
          debug {
              signingConfig signingConfigs.debug
          }
          release {
              // Caution! In production, you need to generate your own keystore file.
              // see https://facebook.github.io/react-native/docs/signed-apk-android.
              signingConfig signingConfigs.release
              minifyEnabled enableProguardInReleaseBuilds
              proguardFiles getDefaultProguardFile(&quot;proguard-android.txt&quot;), &quot;proguard-rules.pro&quot;
          }
      }
  
      packagingOptions {
          pickFirst &quot;lib/armeabi-v7a/libc++_shared.so&quot;
          pickFirst &quot;lib/arm64-v8a/libc++_shared.so&quot;
          pickFirst &quot;lib/x86/libc++_shared.so&quot;
          pickFirst &quot;lib/x86_64/libc++_shared.so&quot;
      }
  
      // applicationVariants are e.g. debug, release
      applicationVariants.all { variant -&gt;
          variant.outputs.each { output -&gt;
              // For each separate APK per architecture, set a unique version code as described here:
              // https://developer.android.com/studio/build/configure-apk-splits.html
              def versionCodes = [&quot;armeabi-v7a&quot;: 1, &quot;x86&quot;: 2, &quot;arm64-v8a&quot;: 3, &quot;x86_64&quot;: 4]
              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 {
      implementation fileTree(dir: &quot;libs&quot;, include: [&quot;*.jar&quot;])
      // implementation 'com.google.android.gms:play-services-auth:18.0.0'
      // implementation &quot;com.google.android.gms:play-services-base:16.0.1&quot;
      // implementation &quot;com.google.firebase:firebase-core:16.0.6&quot;
      // implementation &quot;com.google.firebase:firebase-messaging:17.3.4&quot;
      //noinspection GradleDynamicVersion
      implementation &quot;com.facebook.react:react-native:+&quot;  // From node_modules
  
      implementation &quot;androidx.swiperefreshlayout:swiperefreshlayout:1.0.0&quot;
      compile 'com.android.support:multidex:1.0.1' //enter the latest version
  
      debugImplementation(&quot;com.facebook.flipper:flipper:${FLIPPER_VERSION}&quot;) {
        exclude group:'com.facebook.fbjni'
      }
  
      debugImplementation(&quot;com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}&quot;) {
          exclude group:'com.facebook.flipper'
      }
  
      debugImplementation(&quot;com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}&quot;) {
          exclude group:'com.facebook.flipper'
      }
  
      if (enableHermes) {
          def hermesPath = &quot;../../node_modules/hermes-engine/android/&quot;;
          debugImplementation files(hermesPath + &quot;hermes-debug.aar&quot;)
          releaseImplementation files(hermesPath + &quot;hermes-release.aar&quot;)
      } else {
          implementation jscFlavor
      }
  
      implementation project(':react-native-config')
      compile project(':react-native-onesignal') // I just added this line 
  }
  
  task copyDownloadableDepsToLibs(type: Copy) {
      from configurations.compile
      into 'libs'
  }
  
  apply from: file(&quot;../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle&quot;); applyNativeModulesAppBuildGradle(project)
  apply from: &quot;../../node_modules/react-native-code-push/android/codepush.gradle&quot;
  apply from: &quot;../../node_modules/react-native-vector-icons/fonts.gradle&quot;
  
  apply from: project(':react-native-config').projectDir.getPath() + &quot;/dotenv.gradle&quot;
  
  apply plugin: 'com.google.gms.google-services' // &lt;--- this should be the last line
  </code></pre>
  <p>My src/main/AndroidManifest.xml:</p>
  <pre><code>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    package=&quot;com.smartial&quot;&gt;
  
      &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;com.google.android.c2dm.permission.RECEIVE&quot;/&gt;
  
  
      &lt;application
        android:name=&quot;.MainApplication&quot;
        android:label=&quot;@string/app_name&quot;
        android:icon=&quot;@mipmap/ic_launcher&quot;
        android:allowBackup=&quot;false&quot;
        android:theme=&quot;@style/AppTheme&quot;&gt;
        &lt;activity
          android:name=&quot;.MainActivity&quot;
          android:label=&quot;@string/app_name&quot;
          android:configChanges=&quot;keyboard|keyboardHidden|orientation|screenSize|uiMode&quot;
          android:launchMode=&quot;singleTask&quot;
          android:windowSoftInputMode=&quot;adjustResize&quot;&gt;
          &lt;intent-filter&gt;
              &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
              &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
          &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;activity android:name=&quot;com.facebook.react.devsupport.DevSettingsActivity&quot; /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  <p>My src/debug/AndroidManifest.xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;
  
      &lt;uses-permission android:name=&quot;android.permission.SYSTEM_ALERT_WINDOW&quot;/&gt;
      &lt;uses-permission android:name=&quot;com.google.android.c2dm.permission.RECEIVE&quot;/&gt;
  
      &lt;application android:usesCleartextTraffic=&quot;true&quot; tools:targetApi=&quot;28&quot; tools:ignore=&quot;GoogleAppIndexingWarning&quot; /&gt;
  &lt;/manifest&gt;
  </code></pre>
  <p>Some observations:</p>
  <ul>
  <li>I checked the onesignal setup and followed all the steps again, nothing changed.</li>
  <li>I checked all the issues of this error, questions in the stackoverflow, I tried all the small solutions I could, nothing changed.</li>
  <li>I tried to remove the device directly on the onesignal panel and nothing changed.</li>
  <li>I ran both an avd and a real device, nothing has changed.</li>
  <li>I'm always running on debug, not on release.</li>
  </ul>