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

Build fail with new React Native (0.76) and latest @segment/analytics-react-native #1023

Closed
edapess opened this issue Oct 31, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@edapess
Copy link
Contributor

edapess commented Oct 31, 2024

Error:

> Task :segment_analytics-react-native:compileDebugKotlin FAILED
e: file:///Users/edmondavetisyan/Development/TPL/taild-mobile/node_modules/@segment/analytics-react-native/android/src/main/java/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.kt:128:30 Type mismatch: inferred type is String? but String was expected
  • analytics-react-native version: 2.20.2
  • React Native version: 0.76.0
  • Android

Steps to reproduce
Update project to new React Native and analytics-react-native to 2.20.2
Expected behavior
Project should build successfully
Actual behavior
Build fails

Note

guys I already fixed it in this PR #1022

@edapess edapess added the bug Something isn't working label Oct 31, 2024
@elwafdy
Copy link

elwafdy commented Oct 31, 2024

Same issue here.

@oferRounds
Copy link

oferRounds commented Nov 9, 2024

Update: sorry, missed the PR

anyone find a solution?

@fkrein1
Copy link

fkrein1 commented Nov 13, 2024

@edapess Thanks! I’ve created a patch with your PR and it’s building now using patch-package.

@segment+analytics-react-native+2.20.2.patch

diff --git a/node_modules/@segment/analytics-react-native/android/src/main/java/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.kt b/node_modules/@segment/analytics-react-native/android/src/main/java/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.kt
index a6769bb..589ca78 100644
--- a/node_modules/@segment/analytics-react-native/android/src/main/java/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.kt
+++ b/node_modules/@segment/analytics-react-native/android/src/main/java/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.kt
@@ -125,7 +125,7 @@ class AnalyticsReactNativeModule : ReactContextBaseJavaModule, ActivityEventList
   @ReactMethod
   fun getContextInfo(config: ReadableMap, promise: Promise) {
     val appName: String = reactApplicationContext.applicationInfo.loadLabel(reactApplicationContext.packageManager).toString()
-    val appVersion: String = pInfo.versionName
+    val appVersion: String = pInfo.versionName.toString()
     val buildNumber = getBuildNumber()
     val bundleId = reactApplicationContext.packageName

@alanjcharles
Copy link
Contributor

resolved in 2.20.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants