Simply add the onesignal package to geolocator the sample project, configure correctly the two packages, and run on a device and BOOM the trick happens
App crashes...
Run the app
Add the latest onesignal package (oficial or community) from pub packages and run the app, him will crash....
dont need...
My pubspec
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
onesignal: ^1.0.2
geolocator: ^2.0.1
Version: ^2.0.1
Platform:
Adding the mentioned dependency to onesignal to the pubspec.yaml of example project indeed crashes the application when it is run. However I am at a loss what is really going wrong. From the Logcat I get the following exception:
2018-10-08 10:32:43.785 2448-2448/com.baseflow.geolocatorexample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.baseflow.geolocatorexample, PID: 2448
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/base.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_resources_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/base.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_dependencies_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_resources_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_0_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_4_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_5_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_6_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_7_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_8_apk.apk!/lib/x86, /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_slice_9_apk.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
2018-10-08 10:32:43.792 2448-2448/com.baseflow.geolocatorexample E/AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 12 more
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.baseflow.geolocatorexample-4WQHyjCmVoYfFgYHWY6PwQ==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:35)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:693)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:727)
at android.app.LoadedApk.getResources(LoadedApk.java:954)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2270)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5639)
... 8 more
2018-10-08 10:32:43.836 1635-26918/? W/ActivityManager: Force finishing activity com.baseflow.geolocatorexample/.MainActivity
2018-10-08 10:32:43.881 1635-1650/? I/ActivityManager: Showing crash dialog for package com.baseflow.geolocatorexample u0
@martijn00, are you familiar with this kind of exceptions?
Maybe these libraries are using different Play services versions
@audkar , that is also what I suspect (after reading this SO question).
Unfortunately onesignal is not open source so I cannot check which version they use. Also I am not familiar enough with Android or Gradle to figure out how to properly add dependencies to a library without having them conflict with the same dependencies in other libraries.
If someone knows how to go and debug these kind of issues, I would really appreciate a bit of help ;)
It is open source. They have Github account with flutter / androidSdk.
And they are using very outdated version 12.0.1
Edit: probably v12 is not VERY outdated :D but anyway that onsignal plugins has to update its play services version. I don't know any other way
Thanks @audkar, looks like changes are big that this is indeed the problem. Any suggestions on how to approach this issue?
To me it would make sense if OneSignal updates their dependencies but I am wondering if there is something we could do to prevent these kind of problems.
Thanks for help bros what do you guys think of me opening an issue in the one signal repository begging to update play services ? :D
@vinicioslc that would be awesome, you can also link it here so we can track it from this issue (or other people with the same problem can open it to monitor the status of the issue).
For now I will close this issue, but please feel free to update it with additional information.
I open the issue at OneSignal repository, and made the reference ;)
I followed the step 4 from OneSignal instalation guide and now the app don't crashes anymore i solved this by installing the one signal gradlew plugin mentioned by @jkasten2 from OneSignal.
https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/27#issuecomment-428011934
@vinicioslc thank you very much for the feedback and keeping us updated!
I will definitely start looking into that Gradle plugin from OneSignal and hopefully learn more about Gradle and how to prevent these kind of problems.
Most helpful comment
Thanks for help bros what do you guys think of me opening an issue in the one signal repository begging to update play services ? :D