skip to Main Content

I have an old reactnative project that i am trying to run.
When i have installed the node modules and now running the app on an emulator i get this error below

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.      
   > A problem occurred configuring project ':react-native-async-storage_async-storage'.  
      > Could not resolve all artifacts for configuration ':react-native-async-storage_async-storage:classpath'.
         > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10.
           Required by:
               project :react-native-async-storage_async-storage
            > The consumer was configured to find a runtime of a component compatible with Java 11, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10: 
                - gradle70JavadocElements
                - gradle70RuntimeElements
                - gradle70SourcesElements
                - gradle71JavadocElements
                - gradle71RuntimeElements
                - gradle71SourcesElements
                - gradle75JavadocElements
                - gradle75RuntimeElements
                - gradle75SourcesElements
                - gradle76JavadocElements
                - gradle76RuntimeElements
                - gradle76SourcesElements
                - javadocElements
                - runtimeElementsWithFixedAttribute
                - sourcesElements

I have tried changing the java version, placing the "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10" in the project but it was not initially there.

So i already have kotlin in my machine but i am not sure where the problem is because the library ":react-native-async-storage_async-storage" is the one causing the issue.

And i checked the project and there was no kotlin used before in the project, why is it asking for the kotlin now

2

Answers


  1. For me, this temporary workaround does the job:

    downgrade react-native-async-storage

    yarn upgrade @react-native-async-storage/async-storage@^1.10.0
    

    And downgrade the Kotlin version in react-native-async-storage/build.gradle by replacing:

    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$asyncStorageKtVersion"
    

    with:

    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
    

    Note that you might repeat the last step every time you change something in your node_modules

    Login or Signup to reply.
  2. alternatively, you can add kotlinVersion in android/build.gradle file within buildscript as

    kotlinVersion = "1.6.21"

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search