stripe / stripe-terminal-react-native

React Native SDK for Stripe Terminal
https://stripe.com/docs/terminal/payments/setup-integration?terminal-sdk-platform=react-native
MIT License
105 stars 50 forks source link

Execution failed for task ':app:checkDebugDuplicateClasses'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Failed to transform jackson-core-2.16.1.jar #653

Closed abhijitCN closed 1 month ago

abhijitCN commented 5 months ago

unable to run @stripe/stripe-terminal-react-native in latest react-native 0.73.6 FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'. Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform jackson-core-2.16.1.jar (com.fasterxml.jackson.core:jackson-core:2.16.1) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.

I am using => { buildToolsVersion = "34.0.0" minSdkVersion = 26 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0" } and "dependencies": { "@stripe/stripe-terminal-react-native": "^0.0.1-beta.16", "react": "18.2.0", "react-native": "0.73.6" } and gradle-8.3-all.zip for Android which version is wrong for me Screenshot 2024-03-29 at 2 05 00 PM

nazli-stripe commented 5 months ago

it looks like your project's minSDK is set at 21, but we require at least 26: https://github.com/stripe/stripe-terminal-react-native?tab=readme-ov-file#android

abhijitCN commented 5 months ago

FAILURE: Build failed with an exception.

now I use => I am using => { buildToolsVersion = "34.0.0" minSdkVersion = 26 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0" } and "dependencies": { "@stripe/stripe-terminal-react-native": "^0.0.1-beta.16", "react": "18.2.0", "react-native": "0.73.6" } and gradle-8.3-all.zip for Android also using java version "17.0.10" 2024-01-16 LTS

it looks like your project's minSDK is set at 21, but we require at least 26: https://github.com/stripe/stripe-terminal-react-native?tab=readme-ov-file#android

Capture

DustinBracy commented 5 months ago

I'm having the same issue, not sure how to get around it.

abhijitCN commented 5 months ago

I'm having the same issue, not sure how to get around it.

Hello, can you please share all the versions along with Java, Kotln, React-native, minSdkVersion, targetSdkVersion, and compileSdkVersion that version? and in iOS your project is running fine? please share

DustinBracy commented 5 months ago

I'm having the same issue, not sure how to get around it.

Hello, can you please share all the versions along with Java, Kotln, React-native, minSdkVersion, targetSdkVersion, and compileSdkVersion that version? and in iOS your project is running fine? please share

My iOS app builds fine. Android fails with the issues you mentioned. I'm using target version 33, compile version 34, min version 26, react 18.2, react Native 73.6. I can build fine using the previous version and expo 49 (0.0.1-beta.15), but I'd like to use expo 50 so I can better integrate sentry

Zaynmiraj commented 5 months ago

unable to run @stripe/stripe-terminal-react-native in latest react-native 0.73.6 FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'. Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform jackson-core-2.16.1.jar (com.fasterxml.jackson.core:jackson-core:2.16.1) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.

I am using => { buildToolsVersion = "34.0.0" minSdkVersion = 26 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0" } and "dependencies": { "@stripe/stripe-terminal-react-native": "^0.0.1-beta.16", "react": "18.2.0", "react-native": "0.73.6" } and gradle-8.3-all.zip for Android which version is wrong for me Screenshot 2024-03-29 at 2 05 00 PM

Same problem I am getting

Zaynmiraj commented 5 months ago

I'm having the same issue, not sure how to get around it.

Hello, can you please share all the versions along with Java, Kotln, React-native, minSdkVersion, targetSdkVersion, and compileSdkVersion that version? and in iOS your project is running fine? please share

My iOS app builds fine. Android fails with the issues you mentioned. I'm using target version 33, compile version 34, min version 26, react 18.2, react Native 73.6. I can build fine using the previous version and expo 49 (0.0.1-beta.15), but I'd like to use expo 50 so I can better integrate sentry

how to use in expo ?

nazli-stripe commented 5 months ago

this is an issue due to updating the the underlying Terminal Android SDK to 3.4.0: https://github.com/stripe/stripe-terminal-android/issues/433#issuecomment-1970088784

If you update your gradle.properties to include either android.jetifier.ignorelist = jackson-core or android.enableJetifier = false

does it resolve the issue?

DustinBracy commented 5 months ago

this is an issue due to us underlying the underlying Terminal Android SDK to 3.4.0: stripe/stripe-terminal-android#433 (comment)

If you update your gradle.properties to include either android.jetifier.ignorelist = jackson-core or android.enableJetifier = false

does it resolve the issue?

Still does not resolve the issue. I tried removing the android.enableJetifier=true line completely (after following some recommendations on the google issue tracker), changing it to android.enableJetifier=false, and tried android.jetifier.ignorelist=jackson-core-2.16.1.jar and android.jetifier.ignorelist=jackson-core underneath android.enableJetifier=true in gradle.properties after running npx expo prebuild to generate the android directory. Still getting the same error.

[RUN_GRADLEW] FAILURE: Build failed with an exception.
[RUN_GRADLEW] * What went wrong:
[RUN_GRADLEW] Execution failed for task ':app:checkDebugDuplicateClasses'.
[RUN_GRADLEW] > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
[RUN_GRADLEW]    > Failed to transform jackson-core-2.16.1.jar (com.fasterxml.jackson.core:jackson-core:2.16.1) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
[RUN_GRADLEW]       >
[RUN_GRADLEW] Execution failed for JetifyTransform: /Users/dustin/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.16.1/9456bb3cdd0f79f91a5f730a1b1bb041a380c91f/jackson-core-2.16.1.jar.
[RUN_GRADLEW]          > Failed to transform '/Users/dustin/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.16.1/9456bb3cdd0f79f91a5f730a1b1bb041a380c91f/jackson-core-2.16.1.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 65. (Run with --stacktrace for more details.)
[RUN_GRADLEW]            Suggestions:
[RUN_GRADLEW]             - Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
[RUN_GRADLEW]             - If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
[RUN_GRADLEW] * Try:
[RUN_GRADLEW] > Run with --stacktrace option to get the stack trace.
[RUN_GRADLEW] > Run with --info or --debug option to get more log output.
[RUN_GRADLEW] > Run with --scan to get full insights.
[RUN_GRADLEW] > Get more help at https://help.gradle.org.
[RUN_GRADLEW] BUILD FAILED in 1m 5s
[RUN_GRADLEW] Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
[RUN_GRADLEW] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[RUN_GRADLEW] For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
[RUN_GRADLEW] 435 actionable tasks: 434 executed, 1 up-to-date
[RUN_GRADLEW] Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Build failed
Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
npx exited with non-zero code: 1
    Error: build command failed.
abhijitCN commented 5 months ago

ignorelist

this is an issue due to us underlying the underlying Terminal Android SDK to 3.4.0: stripe/stripe-terminal-android#433 (comment)

If you update your gradle.properties to include either android.jetifier.ignorelist = jackson-core or android.enableJetifier = false

does it resolve the issue?

this is an issue due to us underlying the underlying Terminal Android SDK to 3.4.0: stripe/stripe-terminal-android#433 (comment)

If you update your gradle.properties to include either android.jetifier.ignorelist = jackson-core or android.enableJetifier = false

does it resolve the issue?

this is an issue due to us underlying the underlying Terminal Android SDK to 3.4.0: stripe/stripe-terminal-android#433 (comment)

If you update your gradle.properties to include either android.jetifier.ignorelist = jackson-core or android.enableJetifier = false

does it resolve the issue?

thank you @nazli-stripe app built successfully using android.enableJetifier = false in latest teact native project USING => "react": "18.2.0", "react-native": "0.73.6", buildToolsVersion = "34.0.0" minSdkVersion = 26 compileSdkVersion = 34 targetSdkVersion = 33 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0"

Eonfuzz commented 5 months ago

For those on expo you can write a plugin to edit the gradle.properties file

yourplugin.js

const { withGradleProperties } = require('@expo/config-plugins');

/**
 * tl;dr fix for
 * https://github.com/stripe/stripe-terminal-react-native/issues/653
 *
 * This is a workaround for an issue with the Stripe Terminal SDK and Jetifier.
 * Should be able to remove this once stripe is updated to sdk 18
 * @param {*} config
 * @param {*} customName
 * @returns
 */

const withJetifierIgnoringJackson = (config, customName) => {
  return withGradleProperties(config, async config => {
    config.modResults.push({
      key: 'android.jetifier.ignorelist',
      value: 'jackson-core',
      type: 'property',
    });

    return config;
  });
};
/// Use the plugin
module.exports = withJetifierIgnoringJackson;

and then in appconfig

{
    ...
    plugins: ['./pathto/yourplugin']
}
Brunowilliang commented 5 months ago

For those on expo you can write a plugin to edit the gradle.properties file

yourplugin.js

const { withGradleProperties } = require('@expo/config-plugins');

/**
 * tl;dr fix for
 * https://github.com/stripe/stripe-terminal-react-native/issues/653
 *
 * This is a workaround for an issue with the Stripe Terminal SDK and Jetifier.
 * Should be able to remove this once stripe is updated to sdk 18
 * @param {*} config
 * @param {*} customName
 * @returns
 */

const withJetifierIgnoringJackson = (config, customName) => {
  return withGradleProperties(config, async config => {
    config.modResults.push({
      key: 'android.jetifier.ignorelist',
      value: 'jackson-core',
      type: 'property',
    });

    return config;
  });
};
/// Use the plugin
module.exports = withJetifierIgnoringJackson;

and then in appconfig

{
    ...
    plugins: ['./pathto/yourplugin']
}

Damn, after about 2 days of solving this bug, this solution worked perfectly for me, thank you

DustinBracy commented 5 months ago

For those on expo you can write a plugin to edit the gradle.properties file

yourplugin.js

const { withGradleProperties } = require('@expo/config-plugins');

/**
 * tl;dr fix for
 * https://github.com/stripe/stripe-terminal-react-native/issues/653
 *
 * This is a workaround for an issue with the Stripe Terminal SDK and Jetifier.
 * Should be able to remove this once stripe is updated to sdk 18
 * @param {*} config
 * @param {*} customName
 * @returns
 */

const withJetifierIgnoringJackson = (config, customName) => {
  return withGradleProperties(config, async config => {
    config.modResults.push({
      key: 'android.jetifier.ignorelist',
      value: 'jackson-core',
      type: 'property',
    });

    return config;
  });
};
/// Use the plugin
module.exports = withJetifierIgnoringJackson;

and then in appconfig

{
    ...
    plugins: ['./pathto/yourplugin']
}

This works for me as well, thank you @Eonfuzz!!

nazli-stripe commented 5 months ago

closing this one as there is a working fix, thanks @Eonfuzz for the patch!

isaachinman commented 5 months ago

@nazli-stripe When will you update to sdk 18?

nazli-stripe commented 5 months ago

@isaachinman next release, should be by end of june

Zaynmiraj commented 5 months ago

android/gradle.properties Change it android.enableJetifier=true To android.enableJetifier=false

isaachinman commented 5 months ago

@Eonfuzz Wouldn't it be possible to achieve that without a custom plugin, via expo-build-properties?

hungcaovn commented 5 months ago

For those on expo you can write a plugin to edit the gradle.properties file

yourplugin.js

const { withGradleProperties } = require('@expo/config-plugins');

/**
 * tl;dr fix for
 * https://github.com/stripe/stripe-terminal-react-native/issues/653
 *
 * This is a workaround for an issue with the Stripe Terminal SDK and Jetifier.
 * Should be able to remove this once stripe is updated to sdk 18
 * @param {*} config
 * @param {*} customName
 * @returns
 */

const withJetifierIgnoringJackson = (config, customName) => {
  return withGradleProperties(config, async config => {
    config.modResults.push({
      key: 'android.jetifier.ignorelist',
      value: 'jackson-core',
      type: 'property',
    });

    return config;
  });
};
/// Use the plugin
module.exports = withJetifierIgnoringJackson;

and then in appconfig

{
    ...
    plugins: ['./pathto/yourplugin']
}

@Eonfuzz : I am getting this error with "require('@expo/config-plugins');". Did you get this?

Screenshot 2024-04-07 at 10 02 43
Eonfuzz commented 5 months ago

@Eonfuzz Wouldn't it be possible to achieve that without a custom plugin, via expo-build-properties?

I couldn't see how to edit the specific gradle prop I was after in that documentation, if you find out a way please let me know!

@hungcaovn do you have @expo/config-plugins installed? https://www.npmjs.com/package/@expo/config-plugins

hungcaovn commented 5 months ago

@Eonfuzz : Yes I did

a-eid commented 5 months ago

@nazli-stripe I don't think this is an acceptable solution.

mykel-unwritten commented 4 months ago

changing android.jettifier to false produces a different issue mentioned here https://medium.com/@hasperong/duplicate-class-android-support-v4-app-inotificationsidechannel-found-in-modules-classes-1719262dfdcd

and the fix is to enable jettifier 😓

abhijitCN commented 4 months ago

@mykel-unwritten please check below versions

"react": "18.2.0", "react-native": "0.73.6", buildToolsVersion = "34.0.0" minSdkVersion = 26 compileSdkVersion = 34 targetSdkVersion = 33 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0"

mykel-unwritten commented 4 months ago

hi @abhijitCN pretty much the same, the only difference is im on react-native 0.73.7 and targetSdkVersion is 34

i'm on stripe terminal library beta16

mykel-unwritten commented 4 months ago

disabling jettifier shows me this error, could this be an issue from another library?

Screenshot 2024-04-29 at 8 58 16 PM

enabling jettifier fixes the issue above but jackson core error shows up

Eonfuzz commented 4 months ago

@nazli-stripe given this the "fix" for expo to work correctly with stripe-terminal-react-native could you please add it to your expo setup file?

https://github.com/stripe/stripe-terminal-react-native/blob/afe3fe89483a29e6e91e1e03547f519c94f346e0/src/plugin/withStripeTerminal.ts#L32

lmoy28 commented 3 months ago

Hey, trying to restart this discussion 😄

I've followed the rough path to get here but like @mykel-unwritten, I'm getting an error that's meant to be solved by re-enabling jettifier. What are we meant to do there ? Is there something else we can try ?

Thank you for your help 🤞

More info : Build properties : "minSdkVersion" : 26, "compileSdkVersion" : 34, "targetSdkVersion" : 33

@stripe/stripe-terminal-react-native: ^0.0.1-beta.19 expo ~50.0.19 react 18.2 react-native 0.73.6

nazli-stripe commented 2 months ago

@Eonfuzz added in https://github.com/stripe/stripe-terminal-react-native/pull/754

nazli-stripe commented 1 month ago

beta.20 release updated expo config to automatically disable jettifier for jackson-core

DenisDov commented 4 days ago

in your file android/gradle.properties add this, below android.enableJetifier=true:

android.jetifier.ignorelist=jackson-core