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

2.1.0 - Android getting "Task :adyen_react-native:compileReleaseKotlin FAILED" #485

Closed
simonarcher opened this issue Jul 3, 2024 · 17 comments
Labels
bug Something isn't working

Comments

@simonarcher
Copy link

Describe the bug
At the moment I have the @adyen/react-native package of 2.0.1 running fine.

However, when I try and update to the latest 2.1.0 of the package I get the following error when trying to compile my Android application

Execution failed for task ':adyen_react-native:compileReleaseKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileReleaseJavaWithJavac' (17) and 'compileReleaseKotlin' (1.8).

And Im not entirely sure how to resolve this.

my build.gradle file looks like this

buildscript {
    ext {
        buildToolsVersion = '34.0.0'
        minSdkVersion = 26
        compileSdkVersion = 34
        targetSdkVersion = 34
        supportLibVersion = "27.1.1"
        googlePlayServicesVersion = "16.+"
        googlePlayServicesAuthVersion = "19.2.0"
        kotlinVersion = "1.9.22"

        ndkVersion = "26.1.10909125"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath 'com.google.gms:google-services:4.4.2'
        classpath 'com.google.firebase:perf-plugin:1.4.2'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
    }
}

allprojects {
    repositories {
        maven {
            url("$rootDir/../node_modules/detox/Detox-android")
        }
        google()
        // add in-app messaging dependency
        maven { url 'https://maven.gist.build' }
    }
}

subprojects { subproject ->
    afterEvaluate{
        if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion
            }
        }
    }
}

 wrapper {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

apply plugin: "com.facebook.react.rootproject"

And this only seems to be happening on 2.1.0 update and 2.0.1 seems fine, and I cant seem to identify in breaking change or updates I may need to do from the release notes.

any help or guidance on this would be most appreciated! :)

thanks!

@simonarcher simonarcher added the bug report when a bug report is created label Jul 3, 2024
@descorp
Copy link
Contributor

descorp commented Jul 3, 2024

Hey @simonarcher

What version of React Native, Expo(if any), Android Studio, Java, Gradle Wrapper you are using?

In 2.1.0 we have specified jvmTarget. It was intended to fix exactly the issue you are getting 😅

@simonarcher
Copy link
Author

simonarcher commented Jul 3, 2024

@descorp thanks for the quick reply!

So to answer your questions

  • React Native 0.74.3
  • Android Studio Android Studio Hedgehog | 2023.1.1 Patch 2
  • Java I think is 17.0.10 (not sure how to check.. but attached a screenshot)
  • and my gradle wrapper properties are this
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
networkTimeout=10000
validateDistributionUrl=true

Screenshot 2024-07-03 at 14 03 42

@descorp
Copy link
Contributor

descorp commented Jul 3, 2024

hm.. tomorrow I will try to replicate your setup to see if I can reproduce this issue.
In a meanwhile, could you try removing following lines from ../node_modules/@adyen/react-native/android/build.gradle:

    kotlinOptions {
        jvmTarget = "1.8"
    }

@simonarcher
Copy link
Author

cool will give that a try in the meantime and let you know the results... :)

@devic021
Copy link

devic021 commented Jul 3, 2024

Hey guys

I also had a same issue with latest version and had to remove that part that is added to be able to build android app.

Removed this as a temp solution and after that i can build the app again:

kotlinOptions {
 jvmTarget = "1.8"
}

@simonarcher
Copy link
Author

hm.. tomorrow I will try to replicate your setup to see if I can reproduce this issue. In a meanwhile, could you try removing following lines from ../node_modules/@adyen/react-native/android/build.gradle:

    kotlinOptions {
        jvmTarget = "1.8"
    }

Yeah can also confirm removing this has allowed me to compile the app successfully with no issues. ☺️

@descorp
Copy link
Contributor

descorp commented Jul 4, 2024

Thanks @devic021 @simonarcher 💚

We will investigate how to make this work for everyone!

@descorp descorp pinned this issue Jul 4, 2024
@descorp descorp added bug Something isn't working and removed bug report when a bug report is created labels Jul 4, 2024
@zegenerative
Copy link

zegenerative commented Jul 10, 2024

I have the same issue but then with

'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.

Expo SDK 50

removing the kotlinOptions worked

@descorp
Copy link
Contributor

descorp commented Jul 10, 2024

Thanks @zegenerative

We observe this problem for RN 74+ and working on making support for both old and new versions.

@descorp
Copy link
Contributor

descorp commented Jul 11, 2024

Released 2.1.1.
It should resolve the issue and provide "some" backward compatibility

@devic021
Copy link

@descorp

Thanks, i will test it right away!

@viru-rathore
Copy link

I am using following package configuration, but still getting this error.

    "@adyen/react-native": "2.1.1",
    "react": "18.2.0",
    "react-native": "0.72.6",

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':adyen_react-native:compileDebugKotlin'.

Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).

Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation

@descorp
Copy link
Contributor

descorp commented Jul 12, 2024

Hey @viru-rathore

This is the opposite error :)

If we keep jvmTarget = "1.8":

Inconsistent JVM-target compatibility detected for tasks 'compileReleaseJavaWithJavac' (17) and 'compileReleaseKotlin' (1.8).

If we remove it:

Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).

Could you check if 2.1.0 will work for you?


Consider using JVM Toolchain

Unfortunately, to use Gradle toolchain support, one must use the Android Gradle plugin (AGP) version 8.1.0-alpha09 or higher. As you might know default gradle version for RN is 7.3.1


Could you list your:

  • gradle version
  • android gradle plugin version
  • Java version
  • Android studio version

@descorp
Copy link
Contributor

descorp commented Jul 12, 2024

FYI I can confirm that our latest "Adyen Android SDK" only works on React-Native 0.73+ due to android target limitation.

To make this work for RN 0.72 and below, one needs to:

  • update Android compileTarget to 34
  • set android plugin version to at least 8.1+
  • use version 2.1.0

@viru-rathore
Copy link

FYI I can confirm that our latest "Adyen Android SDK" only works on React-Native 0.73+ due to android target limitation.

To make this work for RN 0.72 and below, one needs to:

  • update Android compileTarget to 34
  • set android plugin version to at least 8.1+
  • use version 2.1.0

This worked for me with given combination.

@simonarcher
Copy link
Author

I can also confirm after updating to 2.1.1 I never got the problem with compiling again. :)

so seems to be all good my side! 🙏 thank you!

(will mark this as closed :) )

@descorp
Copy link
Contributor

descorp commented Jul 20, 2024

Version 2.2.0 has been released.
Hopefully, it resolves duality and serves both old and 73+ React-Native versions - it was tested on Java 17 Zulu (recommended by React Native), but might have issues with older Java versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants