React-native-onesignal: (Android) - App crash on start

Created on 16 May 2018  路  5Comments  路  Source: OneSignal/react-native-onesignal

Description:

Hi I did installed react-native-onesignal and followed the instruction. now app is crashing on start. if I unlink react-native-onesignal again app will work.

Environment

react-native-onesignal v3.2.2 and v3.2.1
I installed it using npm install --save react-native-onesignal
using react native 0.54.2

here is my dependencies:

`dependencies {
compile project(':react-native-onesignal')

compile project(':react-native-device-info')

compile project(':react-native-video')

compile project(':react-native-vector-icons')

compile project(':react-native-sound')

compile project(':react-native-image-crop-picker')

compile project(':react-native-fetch-blob')

compile project(':react-native-audio')

compile project(':lottie-react-native')

compile fileTree(dir: "libs", include: ["*.jar"])

compile "com.android.support:appcompat-v7:23.0.1"

compile ("com.facebook.react:react-native:0.54.2") { force = true }  // From node_modules

}
`

Steps to Reproduce Issue:

  • Install the OneSignal SDK using npm into your project

  • react-native link react-native-onesignal
  • add android:launchMode="singleTop" to AndroidManifest.xml
  • react-native run-android
  • Anything else:

    (crash stacktraces, as well as any other information here)

    05-16 21:14:00.334 1535 1535 E AndroidRuntime: FATAL EXCEPTION: main 05-16 21:14:00.334 1535 1535 E AndroidRuntime: Process: com.appechteachers, PID: 1535 05-16 21:14:00.334 1535 1535 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq; 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at android.app.ActivityThread.-wrap1(ActivityThread.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at android.os.Looper.loop(Looper.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/com.appechteachers-1/base.apk"],nativeLibraryDirectories=[/data/app/com.appechteachers-1/lib/arm, /data/app/com.appechteachers-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:469) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: ... 12 more 05-16 21:14:00.334 1535 1535 E AndroidRuntime: Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.internal.zzbq 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at java.lang.Class.classForName(Native Method) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at java.lang.BootClassLoader.findClass(ClassLoader.java:781) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:504) 05-16 21:14:00.334 1535 1535 E AndroidRuntime: ... 13 more 05-16 21:14:00.334 1535 1535 E AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

    Most helpful comment

    I have that same problem. I did not solve it when I did the above operation. The application is failing. I need your help :( @Nightsd01

    All 5 comments

    @sinapcs what version of google-play-services are you using in your project? Our SDK will automatically include 12.0.1, are you doing anything to downgrade?

    Thanks @Nightsd01. I found the problem.
    I changed
    compile project(':react-native-device-info')
    to
    compile (project(':react-native-device-info')) { exclude group: "com.google.android.gms" }

    and error is gone

    Glad to hear it!

    I have that same problem. I did not solve it when I did the above operation. The application is failing. I need your help :( @Nightsd01

    @Nightsd01 I have a similar issue (app crashing on startup), and was able to "solve" it by replacing

    compile project(':react-native-onesignal')

    by

    compile (project(':react-native-onesignal')) { exclude group: "com.google.android.gms" }

    You mention that OneSignal uses google-play-services v12.0.1 out of the box. However, I'm setting googlePlayServicesVersion = "11.8.0" in my project-level build.gradle. Does OneSignal respect this setting?

    Was this page helpful?
    0 / 5 - 0 ratings