flurry / react-native-flurry-sdk

React Native Flurry SDK
Apache License 2.0
45 stars 13 forks source link

Unable to instantiate service com.flurry.android.marketing.messaging.FCM.FlurryMessageListenerService: java.lang.ClassNotFoundException: Didn't find class #10

Closed markymc closed 4 years ago

markymc commented 5 years ago

It looks like alongside my iOS issue, I have a somewhat similar problem with Android that was reported by our CI and Google Play's pre-launch report:

Screen Shot 2019-06-18 at 10 45 18

It's interesting that not all devices (only 7 out of 10) are affected.

As per my other issue, I'm not using push notifications, so have not followed any of the "FLurry Push" section of the Android setup instructions (e.g. didn't use .withMessaging() etc).


Note I didn't follow this step in the setup instructions as it seems to be optional:

To improve analytics identities, please see Manual Flurry Android SDK Integration for adding Google Play Services library in your app by including the following in your build.gradle file:

dependencies {
    // Recommended to add Google Play Services
    implementation 'com.google.android.gms:play-services-base:15.0.1'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
}

This one is obviously more serious than my iOS issue as it would stop us from releasing the update containing Flurry.

Thanks in advance!

markymc commented 5 years ago

EDIT - Nope, looks like it's been there since the very first version of the app, so not due to this SDK.

~Update - I just checked the APK's entry in Play Store's artifact library, and it looks like com.google.android.c2dm.permission.RECEIVE has somehow got into the Required permissions. It's definitely not in my AndroidManifest.xml. I assume this SDK is injecting it somehow.~

poting-oath commented 5 years ago

@markymc Cannot reproduce it. Does your app's proguard hide FlurryMessageListenerService class?

markymc commented 5 years ago

@poting-oath This is my proguard-rules.pro:

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

-keep class com.mypackage.BuildConfig { *; }

-keep class io.invertase.firebase.** { *; }
-dontwarn io.invertase.firebase.**
poting-oath commented 5 years ago

EDIT - Won't compile with this approach!

@markymc Not sure why this class disappeared in your app. ~Before we can find out the cause, please comment out the following line from your project's node_modules/react-native-flurry-sdk/android/build.gradle.~

dependencies {
    implementation 'com.facebook.react:react-native:+'
    implementation 'com.flurry.android:analytics:11.6.0@aar'
    // implementation 'com.flurry.android:marketing:11.6.0@aar'
}
poting-oath commented 5 years ago

Please add the following lines in your proguard-rules.pro to see whether it preserves the missing class or not,

-keep class com.flurry.android.marketing.messaging.FCM.FlurryMessageListenerService { *; }
-keep class com.flurry.android.marketing.messaging.FCM.FlurryInstanceIDListenerService { *; }
-keep class com.flurry.android.marketing.messaging.notification.NotificationCancelledReceiver { *; }
-keep class com.flurry.android.marketing.messaging.notification.NotificationClickedReceiver { *; }
markymc commented 5 years ago

@poting-oath Thanks. I tried and it didn't seem to help. ~However, it looks like this worked:~ Edit: Google Play's pre-launch report still failed, this time on all devices except one.

-keep class com.flurry.android.** { *; }

markymc commented 5 years ago

I spoke too soon. Google Play's pre-launch report failed, so this is not fixed.

markymc commented 5 years ago

I just realised that Proguard is not enabled for my project, so it shouldn't be a proguard rules issue.

markymc commented 5 years ago

Hmm, so I removed Firebase from our project to test, and it seems to be fine now. Luckily we don't really need Firebase any more, so I'll keep it out. But it's very strange that this was a problem.

poting-oath commented 5 years ago

Closed, looks like it's a integration issue that caused by Firebase leftover that is conflict with Flurry Push. (Yes, Flurry Push does depend on Firebase at run time, that may have conflict with this.)

buchereli commented 4 years ago

I have this same issue except firebase is critical for my app. Is there a work around or do I need to ditch flurry?

buchereli commented 4 years ago

@poting-oath I don't think this issue should be closed.

buchereli commented 4 years ago

Managed to fix this issue by adding:

implementation 'com.google.firebase:firebase-messaging:+'

to my gradle file

poting-oath commented 4 years ago

@buchereli We are working on this issue, and will release the fix as soon as possible. Thanks!

poting-oath commented 4 years ago

@buchereli Do you still have the build issue? We are now compatible with the latest Firebase libraries. Thanks!

poting-oath commented 4 years ago

We are now compatible with the latest Firebase libraries. Thanks!

Closed