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

Fails to build on RN 0.76 #901

Closed
johnf opened this issue Oct 23, 2024 · 11 comments
Closed

Fails to build on RN 0.76 #901

johnf opened this issue Oct 23, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@johnf
Copy link

johnf commented Oct 23, 2024

Expected Behavior

Package should build succesfully

Current Behavior

Task :amplitude_analytics-react-native:compileDebugKotlin FAILED
e: file:///home/johnf/work/gladly/mobile/node_modules/@amplitude/analytics-react-native/android/src/main/java/com/amplitude/reactnative/LegacyDatabaseStorage.kt:64:25 Type mismatch: inferred type is String? but String was expected

Possible Solution

diff --git a/android/src/main/java/com/amplitude/reactnative/LegacyDatabaseStorage.kt b/android/src/main/java/com/amplitude/reactnative/LegacyDatabaseStorage.kt
index cfe7bcab8600fcfdf5d8dd77aeb4ba68ac0a8100..93f2101121cf7e69878f7faeb09ba0e298b9812e 100644
--- a/android/src/main/java/com/amplitude/reactnative/LegacyDatabaseStorage.kt
+++ b/android/src/main/java/com/amplitude/reactnative/LegacyDatabaseStorage.kt
@@ -55,7 +55,7 @@ class LegacyDatabaseStorage(context: Context, databaseName: String) : SQLiteOpen
 
     private fun queryDb(
         db: SQLiteDatabase,
-        table: String?,
+        table: String,
         columns: Array<String?>?,
         selection: String?,
         selectionArgs: Array<String?>?,

Steps to Reproduce

Standard steps to add @amplitude/analytics-react-native to your project

Environment

  • JS SDK Version: 1.4.10
  • Installation Method: yarn
  • Browser and Version: React Native 0.76

Other

As a side note is this package built from this repo? I tried to do a PR but the file in question doesn't exist

@johnf johnf added the bug Something isn't working label Oct 23, 2024
@MonikaGupta756
Copy link

MonikaGupta756 commented Oct 24, 2024

I am facing the same issue only in Android but with RN 0.73.6

node_modules/@amplitude/analytics-react-native/android/src/main/java/com/amplitude/reactnative/LegacyDatabaseStorage.kt:64:25 Type mismatch: inferred type is String? but String was expected


FAILURE: Build failed with an exception.

@huextrat
Copy link

This is on Kotlin SDK, here is a proposal to fix it: amplitude/Amplitude-Kotlin#228

@izaaz
Copy link
Contributor

izaaz commented Oct 24, 2024

The RN SDK does not use the kotlin SDK underneath. This is the file that needs to be changed

https://github.com/amplitude/Amplitude-TypeScript/blob/v1.x/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/LegacyDatabaseStorage.kt

But I wonder why its failing now though? Its been like this for a long time. Do y'all use a stricter type checking that makes this fail?

@huextrat
Copy link

The RN SDK does not use the kotlin SDK underneath. This is the file that needs to be changed

https://github.com/amplitude/Amplitude-TypeScript/blob/v1.x/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/LegacyDatabaseStorage.kt

But I wonder why its failing now though? Its been like this for a long time. Do y'all use a stricter type checking that makes this fail?

@izaaz Ah, good point, we'll have to patch this version with the fix then.

This issue has only existed since version 0.76 of RN, probably due to a change in compatibility with Kotlin

@dpyeates
Copy link

any update on this change getting added please?

@younes0
Copy link

younes0 commented Oct 31, 2024

It seems surprising that Amplitude isn't being very responsive about their React Native SDK (this issue, new architecture...)

This appears particularly noteworthy given React Native's growing popularity among major apps and companies.
One has to wonder if Amplitude's Product Managers are aware of this situation. https://reactnative.dev/showcase

@khomchyk
Copy link

khomchyk commented Nov 1, 2024

It seems surprising that Amplitude isn't being very responsive about their React Native SDK (this issue, new architecture...)

This appears particularly noteworthy given React Native's growing popularity among major apps and companies. One has to wonder if Amplitude's Product Managers are aware of this situation. https://reactnative.dev/showcase

++
A week to merge an one-line fix seems like an unusually relaxed timeline for resolving an issue that's completely blocking Android functionality on the latest production React Native version, especially from a market leader in analytics.

@izaaz
Copy link
Contributor

izaaz commented Nov 4, 2024

Apologies for the delay folks.

Here's the PR.

It looks like this issue only happens when the compileSdk version is set to 35.

@izaaz
Copy link
Contributor

izaaz commented Nov 4, 2024

@huextrat - Thanks for the fix on the kotlin SDK too. It starts throwing an error when I set the compile SDK version to 35 so i'll merge that PR as well.

@izaaz
Copy link
Contributor

izaaz commented Nov 4, 2024

@johnf can you please try version 1.4.11?

@johnf
Copy link
Author

johnf commented Nov 6, 2024

@izaaz looks good

@johnf johnf closed this as completed Nov 6, 2024
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

7 participants