react-native-text-input-mask / react-native-text-input-mask

Text input mask for React Native, Android and iOS
MIT License
1.18k stars 305 forks source link

Build failure with Expo SDK 46/RN 0.69.5 on Android: "Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2." #275

Closed gloredo closed 1 year ago

gloredo commented 1 year ago

Full error log

[stderr] Note: /home/expo/workingdir/build/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/VirtualView.java uses or overrides a deprecated API.
[stderr] Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-text-input-mask:generateDebugBuildConfig
> Task :react-native-text-input-mask:compileDebugKotlin FAILED
[stderr] e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
[stderr] e: /home/expo/.gradle/caches/transforms-3/1bac89c4056caa4ab6a6c0444927097a/transformed/jetified-react-native-0.69.5-debug-api.jar!/META-INF/ReactAndroid_debug.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] e: /home/expo/.gradle/caches/transforms-3/5d5c005847cf8de15717b495cdeb2994/transformed/jetified-kotlin-stdlib-jdk7-1.6.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] e: /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] e: /home/expo/.gradle/caches/transforms-3/f9029077105ee094cb660a998bc51080/transformed/jetified-kotlin-stdlib-jdk8-1.6.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] e: /home/expo/.gradle/caches/transforms-3/fef35b89e5e15dc545425cdee6369ba0/transformed/jetified-kotlin-stdlib-common-1.6.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (35, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (52, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (59, 17): Not enough information to infer type variable T
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (59, 56): Unresolved reference: java
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (66, 58): Unresolved reference: first
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (74, 97): Unresolved reference: let
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (74, 139): Unresolved reference: it
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (78, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (79, 63): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (81, 54): Unresolved reference: emptyList
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (82, 58): Unresolved reference: emptyList
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (99, 15): Unresolved reference: until
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (99, 55): Unresolved reference: it
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (133, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (134, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (138, 28): Unresolved reference: substring
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (139, 37): Unresolved reference: substring
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (144, 18): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (146, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (148, 18): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (153, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (154, 29): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (161, 43): Unresolved reference: emptyList
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (162, 47): Unresolved reference: emptyList
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (170, 23): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (183, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (184, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskModule.kt: (185, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
[stderr] The class is loaded from /home/expo/.gradle/caches/transforms-3/b4bd8b2d8b84f89e1b1eb3315da16eb4/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskPackage.kt: (11, 9): Unresolved reference: listOf
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskPackage.kt: (13, 65): Unresolved reference: emptyList
[stderr] e: /home/expo/workingdir/build/node_modules/react-native-text-input-mask/android/src/main/java/com/RNTextInputMask/RNTextInputMaskPackage.kt: (16, 9): Unresolved reference: emptyList
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':react-native-text-input-mask:compileDebugKotlin'.
[stderr] > Compilation error. See log for more details
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 7m 14s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
643 actionable tasks: 643 executed
Unable to list file systems to check whether they can be watched. The whole state of the virtual file system has been discarded. Reason: Could not query file systems: could not open mount file (errno 2: No such file or directory)
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
gloredo commented 1 year ago

Downgrading kotlinVersion to 1.4.2 is not a solution:

export default {
  ...
  plugins: [
    [
      'expo-build-properties',
      {
        android: {
          kotlinVersion: '1.4.2',
        },
      },
    ],
  ],
}

Returns

Error: `android.kotlinVersion` needs to be at least version 1.6.10.
gerzonc commented 1 year ago

That's because you're trying to downgrade the kotlinVersion instead of upgrading it on the lib. Using patch-package, go to ./node_modules/react-native-text-input-mask/android/build.gradle and on buildscript change kotlinVersion to 1.6.10

Edit: No need to use patch-package, just edit kotlinVersion of your project directly if it's bareflow, if it's managed just do this:

{
  "expo": {
    "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "kotlinVersion": "1.6.10"
          }
        }
      ]
    ]
  }
}
gloredo commented 1 year ago

@gerzonc wow, I didn't know the patch-package, very cool and it worked. Using expo-build-properties I got the same error, I think it's 1.6.x by default.

gloredo commented 1 year ago

Closing as unresolved why kotlin version needs to be updated.