question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getExtOrDefault KotlinVersion

See original GitHub issue

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-text-input-mask@3.1.4 for the project I’m working on.

Related issues: #249 #268

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-text-input-mask/android/build.gradle b/node_modules/react-native-text-input-mask/android/build.gradle
index c94f33f..ff67cac 100644
--- a/node_modules/react-native-text-input-mask/android/build.gradle
+++ b/node_modules/react-native-text-input-mask/android/build.gradle
@@ -26,8 +26,8 @@ android {
 }
 
 buildscript {
-    ext {
-        kotlinVersion = '1.4.31'
+    ext.safeExtGet = {prop, fallback ->
+        rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
     }
     repositories {
         jcenter()
@@ -36,7 +36,7 @@ buildscript {
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:4.1.3'
-        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.ext.kotlinVersion}"
+        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.6.10')}"
     }
 }
 
@@ -53,5 +53,5 @@ repositories {
 dependencies {
     implementation 'com.facebook.react:react-native:+'
     implementation 'com.redmadrobot:input-mask-android:6.0.0'
-    implementation "org.jetbrains.kotlin:kotlin-stdlib:${project.ext.kotlinVersion}"
+    implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion', '1.6.10')}"
 }

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:17
  • Comments:5

github_iconTop GitHub Comments

1reaction
lucaspmvcommented, Jul 25, 2022

Thank you! it worked for me, only had to change the classpath 'com.android.tools.build:gradle:4.1.3' to classpath 'com.android.tools.build:gradle:7.1.1' too.

1reaction
FDiskascommented, Jul 18, 2022

You should try cd ios && rm -rf Pods && pod install

Read more comments on GitHub >

github_iconTop Results From Across the Web

https://raw.githubusercontent.com/react-native-com...
buildscript { //Buildscript is evaluated before everything else so we can't use getExtOrDefault def kotlin_version = rootProject.ext.has('kotlinVersion') ?
Read more >
Could not resolve all task dependencies for configuration
I am trying to create a react native plugin project. As part of the project, I need to use external artifacts and apply...
Read more >
fix checkupdates never runs on MRs (!12042) · Merge requests · F ...
Since CI in the main repository doesn't check everything per se, we should let it do that. This MR exactly matches the original...
Read more >
react-native-webview:compileDebugJavaWithJavac FAILED
classpath("com.android.tools.build:gradle:3.6.0") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
Read more >
Kotlin 1.5.20 Released! - The JetBrains Blog
Kotlin continues to stay up to date with latest Java features such as dynamic invocations and to provide better interoperability with Java ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found