Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 opened this issue Mar 29, 2024 · 31 comments

Comments

@abhijitCN
Copy link

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
Copy link
Collaborator

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
Copy link
Author

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}.
> Execution failed for JetifyTransform: C:\Users\FN.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.16.1\9456bb3cdd0f79f91a5f730a1b1bb041a380c91f\jackson-core-2.16.1.jar.
> Failed to transform 'C:\Users\FN.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.)
Capture

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

@abhijitCN abhijitCN changed the title Build failed to run @stripe/stripe-terminal-react-native in latest react-native 0.73.6 Execution failed for task ':app:checkDebugDuplicateClasses'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Failed to transform jackson-core-2.16.1.jar Mar 31, 2024
@DustinBracy
Copy link

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

@abhijitCN
Copy link
Author

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
Copy link

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
Copy link

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
Copy link

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
Copy link
Collaborator

nazli-stripe commented Apr 2, 2024

this is an issue due to updating the 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?

@DustinBracy
Copy link

DustinBracy commented Apr 2, 2024

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
Copy link
Author

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
Copy link

Eonfuzz commented Apr 3, 2024

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
Copy link

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
Copy link

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
Copy link
Collaborator

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

@isaachinman
Copy link

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

@nazli-stripe
Copy link
Collaborator

@isaachinman next release, should be by end of june

@Zaynmiraj
Copy link

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

@isaachinman
Copy link

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

@hungcaovn
Copy link

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
Copy link

Eonfuzz commented Apr 8, 2024

@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
Copy link

@Eonfuzz : Yes I did

@a-eid
Copy link
Contributor

a-eid commented Apr 17, 2024

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

@mykel-unwritten
Copy link

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
Copy link
Author

@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
Copy link

mykel-unwritten commented Apr 29, 2024

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
Copy link

mykel-unwritten commented Apr 29, 2024

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
Copy link

Eonfuzz commented May 8, 2024

@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?

const withStripeTerminal: ConfigPlugin<StripeTerminalPluginProps> = (

@lmoy28
Copy link

lmoy28 commented Jun 12, 2024

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
Copy link
Collaborator

@Eonfuzz added in #754

@nazli-stripe
Copy link
Collaborator

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

@DenisDov
Copy link

DenisDov commented Sep 19, 2024

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

android.jetifier.ignorelist=jackson-core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests