Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Including Google Analytics crashes the app #4172

Closed
satya164 opened this issue Nov 17, 2015 · 13 comments
Closed

[Android] Including Google Analytics crashes the app #4172

satya164 opened this issue Nov 17, 2015 · 13 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@satya164
Copy link
Contributor

When I try to include the Google analytics library in an React Native app, it crashes.

Here are the intsructions I followed - https://developers.google.com/analytics/devguides/collection/android/v4/

Here is the log,

11-17 18:33:47.672  11116-11116/? I/art﹕ Late-enabling -Xcheck:jni
11-17 18:33:48.124  11116-11153/? I/GMPM﹕ App measurement is starting up
11-17 18:33:48.225  11116-11116/? I/CrashlyticsCore﹕ Initializing Crashlytics 2.3.5.79
11-17 18:33:48.856  11116-11218/? D/OpenGLRenderer﹕ Use EGL_SWAP_BEHAVIOR_PRESERVED: true
11-17 18:33:48.881  11116-11116/? D/Atlas﹕ Validating map...
11-17 18:33:48.936  11116-11218/? I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build:  ()
    OpenGL ES Shader Compiler Version: E031.25.03.04
    Build Date: 04/06/15 Mon
    Local Branch:
    Remote Branch:
    Local Patches:
    Reconstruct Branch:
11-17 18:33:48.942  11116-11218/? I/OpenGLRenderer﹕ Initialized EGL, version 1.4
11-17 18:33:49.012  11116-11218/? D/OpenGLRenderer﹕ Enabling debug mode 0
11-17 18:33:49.053  11116-11116/? W/unknown:React﹕ You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
11-17 18:33:49.075  11116-11116/? W/unknown:React﹕ Unable to dispatch keyboard events in JS as the react instance has not been attached
11-17 18:33:49.279  11116-11116/? W/unknown:React﹕ You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
11-17 18:33:50.263  11116-11116/? E/art﹕ dlopen("/data/app/io.scrollback.neighborhoods-2/lib/arm/libreactnativejni.so", RTLD_LAZY) failed: dlopen failed: library "libjsc.so" not found
11-17 18:33:50.263  11116-11116/? D/AndroidRuntime﹕ Shutting down VM
11-17 18:33:50.366  11116-11116/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: io.scrollback.neighborhoods, PID: 11116
    java.lang.UnsatisfiedLinkError: dlopen failed: library "libjsc.so" not found
            at java.lang.Runtime.load(Runtime.java:331)
            at java.lang.System.load(System.java:981)
            at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:63)
            at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:209)
            at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:178)
            at com.facebook.react.bridge.JSCJavaScriptExecutor.<clinit>(JSCJavaScriptExecutor.java:19)
            at com.facebook.react.ReactInstanceManager.onJSBundleLoadedFromServer(ReactInstanceManager.java:448)
            at com.facebook.react.ReactInstanceManager.access$100(ReactInstanceManager.java:74)
            at com.facebook.react.ReactInstanceManager$1.onJSBundleLoadedFromServer(ReactInstanceManager.java:105)
            at com.facebook.react.devsupport.DevSupportManager$13$1.run(DevSupportManager.java:555)
            at android.os.Handler.handleCallback(Handler.java:746)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5343)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
11-17 18:33:52.477  11116-11181/? I/CrashlyticsCore﹕ Crashlytics report upload complete: 564B25B40153-0001-2B6C-D33FC7298713.cls

Any ideas?

@satya164
Copy link
Contributor Author

Extracting the APK reveals that it contains the following inside lib,

libfb.so             libfolly_json.so     libgnustl_shared.so
libfbjni.so          libglog.so           libreactnativejni.so

While when building without Google Analytics, it contains following,

libbitmaps.so        libglog.so           libmemchunk.so
libfb.so             libgnustl_shared.so  libreactnativejni.so
libfbjni.so          libicu_common.so     libwebp.so
libfolly_json.so     libimagepipeline.so  libwebpimage.so
libgifimage.so       libjsc.so

@mkonicek
Copy link
Contributor

Don't understand why adding Google analytics would remove the native libraries from the APK. Can you debug what part of the Google analytics setup does that? Can you try again to double check / try unzipping the APK and adding them back?

@mangogogos
Copy link
Contributor

Could this be related to #2814 ?

@ide ide added the Android label Nov 17, 2015
@satya164
Copy link
Contributor Author

Sorry for late reply. Was busy with other stuff. Will try to reproduce this with a new project and post the results.

@calflegal
Copy link

For what it's worth, I've been trying to use google sign in, not google analytics, but I have a very similar issue. Here is that documentation:
https://developers.google.com/identity/sign-in/android/start-integrating

Oddly enough, when I build with 1.5.0-beta3 as that page instructs at the time of writing, my apk contains NO libs directory, and hence crashes with the issue listed at #2814

Building with 1.5.0 (not beta) does include a libs folder, though that build fails with error, 'won't run unless you update google play services'.

I realize that is perhaps not the most helpful, but perhaps 1.5.0 will be compatible?

@scgough
Copy link

scgough commented Nov 24, 2015

hi,
I've just been having this problem with Google Analytics and I managed to get around the issue by switching from:
classpath 'com.google.gms:google-services:1.5.0-beta2'
to
classpath 'com.google.gms:google-services:1.5.0'

This instantly seems to remedy the issue (as @calflegal mentioned)

@calflegal
Copy link

Excellent. @scgough are you running on the emulator or on a device? Would you mind sharing your Google Play services version as listed on the device in Settings > Apps > Google Play services?

I'm running in the emulator, Google Play services version 8.1.85 (2247395-470)

My language in my comment was a little incorrect...my build doesn't fail, I get an error message of 'APPNAME won't run unless you update Google Play services' when I run the app on the emulator...

@scgough
Copy link

scgough commented Nov 24, 2015

Sure @calflegal

I'm running on a device (well, 2) and they both have: v8.3.01 (2385995-036)
We have tested on a virtual (Genymotion) device but I don't have access to that I'm afraid. It produced the same instant crash though.

@satya164
Copy link
Contributor Author

@scgough Thanks. Going to try it now.

@satya164
Copy link
Contributor Author

@scgough Seems to be working. Thanks a lot.

@scgough
Copy link

scgough commented Nov 25, 2015

great. glad that helped @satya164
I have it working (as far as I can tell!) using that change above

@satya164
Copy link
Contributor Author

Not sure if I should close this issue or not. This seems like a GA issue, but need to do more investigation on why it was even happening.

@akhilashok15
Copy link

akhilashok15 commented Jun 24, 2016

Google Analytics integration in android apps causes Android Not Responding in some android devices,why?
and What is the solution?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants