Hi, I’ve set up rudderstack via the react native s...
# support
e
Hi, I’ve set up rudderstack via the react native sdk. The events are flowing in the development build, but I don’t receive any events by the app built by our deploy pipeline (tested just Android app via Internal testing on Play Console). I verified that: • the env vars (URL and WRITE_KEY) are set correctly • the prod env vars work when used locally - the events are flowing to the production source • the app knows the vars (it’s set up to crash on missing vars) Is it possible there’s different behavior on a production build? Did I miss a step, or should everything work out of the box and I need to continue debugging the prod build?
the setup I use: • `App.tsx`:
Copy code
<*providers*>
  <RudderStackInit />
  <RootStackNavigator />
</*providers*>
• `RudderStackInit.tsx`:
Copy code
export const RudderStackInit = () => {
  useEffect(() => {
    rudderClient
      .setup(config.rudderstackWriteKey, {
        dataPlaneUrl: config.rudderstackUrl,
        trackAppLifecycleEvents: true,
      })
      .catch((e) => handleError(e))
  }, [])

  return null
}
c
Hey @eager-pizza-76165, Could you inform us if there are any ProGuard rules implemented in your Android app? If so, please refer to our documentation and follow the steps: https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-react-native-sdk/#do-i-need-to-add-anything-to-my-proguard-rules.
e
hi, no, I don’t see any specific proguard rules in place. the
android/app/proguard-rules.pro
files is empty and our
android/app/build.gradle
looks like this (uses default
proguard-android.txt
):
Copy code
...
def enableProguardInReleaseBuilds = false
...
android {
    ...
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    ...
}
...
but I can definitely try putting the
Copy code
-keep class com.rudderstack.android.** { *; }
line into
proguard-rules.pro
and do another release. frankly, I’m not experienced with proguard, so please tell me whether it makes sense. also, if this is a rule that should be always present, it may make sense to reference it in the setup section od the docs, now it’s only at the bottom of the FAQ.
c
The ProGuard rules are not mandatory, if you have some rules already in place in your Android app then only you need to add those rules. For now, you may skip this steps as you don’t have any ProGuard rules. As a next steps: • Could you please adjust the log settings of your app to VERBOSE, launch the production app on one of your physical Android devices, connect that device to Android Studio, and then provide us with the log information of that app? Follow this steps to set the log to VERBOSE: https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-react-native-sdk/#debugging • Additionally, can you also try to make events using iOS production apps and check if you receive the events or not.
k
Hey @eager-pizza-76165, Were you able to resolve this ?
c
Hey @eager-pizza-76165, Sorry for the misunderstanding on my part. Actually, it appears that
proguard
rules are enabled on your release build.
Copy code
release {
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
this line basically:
minifyEnabled enableProguardInReleaseBuilds
Hence you need to follow this steps mentioned earlier, refer here.
🙌 1
e
enableProguardInReleaseBuilds
is set to false as seen in my code. however, the issue is now indeed resolved, but I can’t really confirm it was the proguard rule that made the difference 😕
c
Do you have any insight as to why the event wasn’t sent? In my opinion, this issue may have occurred due to ProGuard rules or a network-related problem.
e
I’m sorry, no real visibility into it. It was hard for me to test the real production build often and we’ve made several environment changes between the time it didn’t work and the time I noticed it does. But proguard rule was one of those changes, so it’s entirely possible that was the one.
👍 1