stripe-terminal-react-native: When creating a new react native project and adding the sdk, it fails to build.

Describe the bug If you follow these steps you’ll be able to reproduce the problem. I confirmed with a Stripe engineer on your Discord server and suggested to create an issue.

To Reproduce Steps to reproduce the behavior:

1- create a new react app using npx react-native init 2- npm i @stripe/stripe-terminal-react-native 3- change the minSdkVersion to 26 on build.gradle 3- build for android

Expected behavior It will error out:

‘compileDebugJavaWithJavac’ task (current target is 17) and ‘compileDebugKotlin’ task (current target is 1.8) jvm target compatibility should be set to the same Java version. Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain * Try:

I tried solving by playing with these settings unsuccessfully on the build.gradle file

        compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
kotlin {
    jvmToolchain(17)
}

Stripe Terminal React Native SDK version

  • ^0.0.1-beta.14

Thank you!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 17

Most upvoted comments

Seeing this as well. I’m confused why the versions of (source/target)Compatibility and jvmTarget would be set to 1.8 for this package in the first place if the jvmToolchain is set to 17. Will have to patch this package for now until this is fixed which isn’t a great experience.

Can you please share the solution you did?

Of course! I used the patch-package package to locally modify this package on install. The fix was to modify the @stripe/stripe-terminal-react-native/android/build.gradle file to have a consistent Java version of 17.

I just looked at the PRs for this repo and saw somebody made one with the exact fix I did locally, so hopefully this will be fixed for real soon.

@hungcaovn @MBasiak we just released https://github.com/stripe/stripe-terminal-react-native/releases/tag/v0.0.1-beta.17 to address the Expo plugin issue

@abhijitCN the jackson issue is something separate and is due to the update in the native Terminal SDKs: https://github.com/stripe/stripe-terminal-react-native/issues/653

Seeing this as well.

I’m confused why the versions of (source/target)Compatibility and jvmTarget would be set to 1.8 for this package in the first place if the jvmToolchain is set to 17. Will have to patch this package for now until this is fixed which isn’t a great experience.

Hello guys, after upgrading to v0.0.1-beta.16 I am unable to run npx expo start. It says: PluginError: Failed to resolve plugin for module "@stripe/stripe-terminal-react-native" relative to "....(path to my project)"

Thank you very much! ❤️

Any updates on a more automatic solution for this at the project level? This is causing additional setup time for our development team and we are having a hard time finding a solution. As well since this is a package build.gradle file we cannot commit these changes for others to use.

I was getting the same thing, but was able to build by changing kotlinOptions.jvmTarget from 18 to 17 (same as the jvmToolchain version) in both our app/build.gradle and node_modules/@stripe/stripe-terminal-react-native/android/build.gradle.

In the stripe-terminal-react-native/build.gradle I I also updated the stripe-terminal-android version to the just released 3.2.1 version which supports api level 34.

Note that kotlinOptions.jvmTarget is deprecated since gradle 8 so can be removed as well https://docs.gradle.org/current/userguide/upgrading_version_7.html#kotlin_dsl_plugin_toolchains