Closed chinvib66 closed 3 years ago
So, I solved this by setting kotlinVersion
in project/android/build.gradle
to the installed version 1.4.10
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
kotlinVersion = "1.4.10"
}
.... rest of the code
From the logs in my 1st comment I see that the problem lies in the usage of Unit
class in the package, which is introduced in Kotlin v 1.3.50
; while the package specifies default version to be used as 1.3.21
as seen here.
So, I guess the defaultKotlinVersion for the package needs to be upgraded to atleast 1.3.50
for proper functioning.
I have this problem and it is solved by adding the kotlin version, but it only works for the debug version. When generating an apk for the release version, the app crashes and shows the following error: Does anyone know how to fix this error?
I fixed this by updating node_modules/@segment/analytics-react-native/android/build.gradle
line 9 to:
ext.defaultKotlinVersion = '1.3.50'
and used patch-package to save the changes:
npx patch-package @segment/analytics-react-native
your patches/@segment+analytics-react-native+1.3.1.patch
should look like:
diff --git a/node_modules/@segment/analytics-react-native/android/build.gradle b/node_modules/@segment/analytics-react-native/android/build.gradle
index 54cffd4..7388e1e 100644
--- a/node_modules/@segment/analytics-react-native/android/build.gradle
+++ b/node_modules/@segment/analytics-react-native/android/build.gradle
@@ -6,7 +6,7 @@ def safeExtGet(prop, fallback) {
}
buildscript {
- ext.defaultKotlinVersion = '1.3.21'
+ ext.defaultKotlinVersion = '1.3.50'
repositories {
jcenter()
Now it builds in debug and release mode.
Hopefully Segment release an official fix soon!
Setting ext.defaultKotlinVersion
to 1.3.50
solved this problem for me - but I'm really confused why this all of a sudden became an issue. We haven't touched this integration in at least a few weeks - was Kotlin programmed to start failing forEach((Map.Entry<K, V>) -> Unit): Unit
on October 16, 2020 or something?
Regardless - I'm hoping the Segment team will release an official patch quickly.
This wasn't enough for me.
I also needed to add a rule to proguard-rules.pro
See https://github.com/segmentio/analytics-react-native/issues/227#issuecomment-714789154
The main issue here should have been fixed by https://github.com/segmentio/analytics-react-native/pull/223.
Closing this out unless someone else is facing the same issue with the kotlin version
We are facing this comileDebugKotlin Failed
issue again and is open issue here: #289
Fixed mentioned by @SMJ93 dint work this time. Can someone please help?
We are facing this
comileDebugKotlin Failed
issue again and is open issue here: #289 Fixed mentioned by @SMJ93 dint work this time. Can someone please help?
i got this fixed using a workaround below https://github.com/segmentio/analytics-react-native/issues/289#issuecomment-818736118
Hey guys, I have found these two lines in the log: One is: react-native-agora:compileDebugKotlin Two is: Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.0.
So then i updated my android/build.gradle. So i basically add this line under ext
ext {
....... other code
kotlinVersion = "1.6.0"
}
That's it. It is working perfectly now 🎉🚀✌️
This problem started after updating Android Studio and Kotlin plugin to latest versions, on Windows as well as Ubuntu.
React Native: 0.63.2 Android Studio Version 4.1 Kotlin Version: 1.4.10
Command:
yarn run android
Logs: