upgrade-support icon indicating copy to clipboard operation
upgrade-support copied to clipboard

RN upgrade from 0.72.4 to 0.73.11 Android build :gradle-plugin:compileKotlin fails with Kotlin 1.8 and gradle 8.3

Open IshmeetSingh06 opened this issue 6 months ago • 0 comments

Environment

Env Info
System:
  OS: macOS 15.4.1
  CPU: (14) arm64 Apple M4 Pro
  Memory: 222.78 MB / 24.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.13.0
    path: ~/.nvm/versions/node/v22.13.0/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.2
    path: ~/.nvm/versions/node/v22.13.0/bin/npm
  Watchman:
    version: 2025.05.19.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.25659.59.2432.13423653
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.7
    path: /opt/homebrew/opt/openjdk@21/bin/javac
  Ruby:
    version: 3.4.4
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Things I’ve done to figure out my issue

Upgrading version

0.73.11

Description

I'm upgrading my app from 0.72.4 to 0.73.11, I have followed the exact changes from the https://upgrade-helper.netlify.app/?from=0.72.4&to=0.73.11

IOS build was sucessfull and running

But on android as specified in the helper I bumped the kotlin version from 1.6.10 to 1.8.0 and bumped the gralde from 7.5.1 to 8.3, inside my android/build.gradle

kotlinVersion = '1.8.0'
kotlin_version = '1.8.0'

I have also updated the distributionUrl in the gradle wrapper properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Upon running the android gradle sync and build I keep getting these errors on the :gradle-plugin:compileKotlin step:

<user>/.gradle/wrapper/dists/gradle-8.3-all/6en3ugtfdg5xnpx44z4qbwgas/gradle-8.3/lib/kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
<user>/.gradle/wrapper/dists/gradle-8.3-all/6en3ugtfdg5xnpx44z4qbwgas/gradle-8.3/lib/kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
<user>/.gradle/wrapper/dists/gradle-8.3-all/6en3ugtfdg5xnpx44z4qbwgas/gradle-8.3/lib/kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
<user>/.gradle/wrapper/dists/gradle-8.3-all/6en3ugtfdg5xnpx44z4qbwgas/gradle-8.3/lib/kotlin-stdlib-common-1.9.0.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.

here is my android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 24 as Integer
        compileSdkVersion = 34 as Integer
        targetSdkVersion = 34 as Integer
        ndkVersion = "25.1.8937393"
        kotlinVersion = kotlin_version
        kotlin_version = kotlin_version
        glideVersion = glide_version
        playServicesVersion = "18.0.1"
        playServicesLocationVersion = "19.0.1"
        enableHermes = true
        nodeModulesDir = gradle.NODE_MODULES_DIR
        applicationId = application_id
    }

    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.android.tools.build:gradle:7.3.1'
        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:2.9.4'
        classpath 'com.newrelic.agent.android:agent-gradle-plugin:7.6.2'
        classpath 'com.facebook.react:react-native-gradle-plugin'
    }
}

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$gradle.NODE_MODULES_DIR/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$gradle.NODE_MODULES_DIR/jsc-android/dist")
        }

        maven {
            url "$gradle.NODE_MODULES_DIR/@notifee/react-native/android/libs"
        }

        mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }

        google()
        maven { url 'https://www.jitpack.io' }
    }
}

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

my package.json

package.json
{
    "name": "market-app-test",
    "description": "test-app",
    "version": "0.0.187",
    "main": "src/index.tsx",
    "module": "src/index.tsx",
    "react-native": "src/index.tsx",
    "local": "src/index.tsx",
    "browser": "src/index.web.tsx",
    "scripts": {
        "android": "react-native run-android",
        "ios": "react-native run-ios",
        "start": "react-native start",
        "start:reset": "react-native start --reset-cache",
        "android:clean": "cd android && ./gradlew clean && cd ..",
        "ios:clean": "cd ios && xcodebuild clean && cd ../",
        "pod-install": "npx pod-install ios/",
        "test": "echo \"Run tests from root\" && exit 1",
        "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
        "clean": "del dist",
        "build": "npm run clean && bob build"
    },
    "files": [
        "src",
        "conf",
        "typings",
        "dist",
        "__mocks__",
        "!**/__tests__"
    ],
    "license": "UNLICENSED",
    "dependencies": {
        "@bam.tech/react-native-image-resizer": "^3.0.11",
        "@notifee/react-native": "^7.5.0",
        "@react-native-camera-roll/camera-roll": "^7.9.0",
        "@react-native-clipboard/clipboard": "1.11.0",
        "@react-native-community/netinfo": "^11.4.1",
        "@react-native-firebase/analytics": "17.3.2",
        "@react-native-firebase/app": "17.3.2",
        "@react-native-firebase/crashlytics": "17.3.2",
        "@react-native-firebase/messaging": "17.3.2",
        "@react-native-firebase/perf": "17.3.2",
        "@rest-hooks/endpoint": "3.7.0",
        "@rest-hooks/hooks": "3.1.11",
        "@rest-hooks/react": "7.2.5",
        "@rest-hooks/rest": "6.3.8",
        "@sentry/browser": "*",
        "@shopify/flash-list": "^1.7.1",
        "big-integer": "1.6.51",
        "core-js": "^3.40.0",
        "date-fns": "^2.28.0",
        "js-cookie": "3.0.1",
        "jwt-decode": "^4.0.0",
        "memoize-one": "^5.2.1",
        "nanoid": "^3.3.1",
        "newrelic": "^9.2.0",
        "newrelic-react-native-agent": "1.5.3",
        "react-error-boundary": "3.1.4",
        "react-native-audio-recorder-player": "^3.6.12",
        "react-native-bootsplash": "4.x",
        "react-native-create-thumbnail": "^2.0.1",
        "react-native-device-info": "^11.1.0",
        "react-native-document-picker": "9.x",
        "react-native-file-access": "^2.5.3",
        "react-native-file-viewer": "^2.1.5",
        "react-native-otp-verify": "^1.1.8",
        "react-native-permissions": "^3.9.0",
        "react-native-render-html": "^6.3.4",
        "save": "^2.9.0",
        "schema-dts": "^1.1.2",
        "search-insights": "^2.2.3",
    },
    "peerDependencies": {
        "@lottiefiles/react-lottie-player": "3.x",
        "@react-native-masked-view/masked-view": "*",
        "@react-navigation/bottom-tabs": "6.x",
        "@react-navigation/core": "6.x",
        "@react-navigation/native": "6.x",
        "@react-navigation/native-stack": "6.x",
        "@react-navigation/stack": "6.x",
        "@sentry/browser": "*",
        "firebase": "9.x",
        "lottie-react-native": "6.x",
        "react": "*",
        "react-native": "*",
        "react-native-bootsplash": "4.x",
        "react-native-date-picker": "4.x",
        "react-native-document-picker": "9.x",
        "react-native-fast-image": "8.x",
        "react-native-fs": "2.*",
        "react-native-geolocation-service": "*",
        "react-native-gesture-handler": "2.x",
        "react-native-haptic-feedback": "1.x",
        "react-native-linear-gradient": "2.x",
        "react-native-maps": ">=0.29.0",
        "react-native-safe-area-context": "3.x",
        "react-native-screens": "3.x",
        "react-native-shimmer-placeholder": "2.x",
        "react-native-svg": "*",
        "react-native-video": "5.x",
        "react-native-webview": "13.x"
    },
    "peerDependenciesMeta": {
        "react-native-fast-image": {
            "optional": true
        },
        "react-native-gesture-handler": {
            "optional": true
        },
        "@sentry/browser": {
            "optional": true
        },
        "@sentry/tracing": {
            "optional": true
        },
        "firebase": {
            "optional": true
        }
    },
    "devDependencies": {
        "@babel/core": "7.21.0",
        "@babel/plugin-proposal-numeric-separator": "7.18.6",
        "@babel/preset-env": "7.20.2",
        "@babel/preset-typescript": "7.21.0",
        "@babel/runtime": "7.21.0",
        "@react-native-async-storage/async-storage": "1.20.0",
        "@react-native/babel-preset": "0.73.21",
        "@react-native/eslint-config": "0.73.2",
        "@react-native/metro-config": "0.73.5",
        "@react-native/typescript-config": "0.73.1",
        "@react-native-masked-view/masked-view": "0.3.2",
        "@react-navigation/bottom-tabs": "6.3.1",
        "@react-navigation/core": "6.2.1",
        "@react-navigation/native": "6.0.10",
        "@react-navigation/native-stack": "6.6.1",
        "@react-navigation/stack": "6.2.1",
        "@rest-hooks/test": "10.2.1",
        "@sentry/browser": "6.19.7",
        "@sentry/tracing": "6.19.7",
        "@tsconfig/react-native": "2.0.3",
        "@types/jest": "29.4.0",
        "@types/js-cookie": "3.0.2",
        "@types/react": "^18.2.6",
        "@types/react-test-renderer": "18.0.0",
        "@typescript-eslint/eslint-plugin": "5.53.0",
        "@typescript-eslint/parser": "5.53.0",
        "babel-jest": "^29.6.3",
        "del-cli": "^4.0.1",
        "dotenv": "^16.0.0",
        "eslint": "8.34.0",
        "firebase": "9.9.4",
        "jest": "^29.6.3",
        "prettier": "2.8.8",
        "lottie-react-native": "6.3.1",
        "react": "18.2.0",
        "react-native": "0.73.11",
        "react-native-builder-bob": "0.18.2",
        "react-native-date-picker": "4.2.9",
        "react-native-document-picker": "9.1.2",
        "react-native-fast-image": "8.6.1",
        "react-native-fs": "2.19.0",
        "react-native-geolocation-service": "^5.3.0-beta.4",
        "react-native-gesture-handler": "2.9.0",
        "react-native-haptic-feedback": "1.13.0",
        "react-native-image-picker": "4.10.2",
        "react-native-linear-gradient": "2.5.6",
        "react-native-maps": "0.31.1",
        "react-native-safe-area-context": "3.4.1",
        "react-native-screens": "3.29.0",
        "react-native-shimmer-placeholder": "2.0.8",
        "react-native-svg": "13.8.0",
        "react-native-svg-transformer": "1.0.0",
        "react-native-video": "5.2.1",
        "react-native-webview": "13.10.5",
        "react-test-renderer": "18.2.0",
        "typescript": "5.0.4"
    },
    "jest": {
        "preset": "react-native",
        "moduleFileExtensions": [
            "ts",
            "tsx",
            "js",
            "jsx",
            "json",
            "node"
        ]
    },
    "react-native-builder-bob": {
        "source": "src",
        "output": "dist",
        "targets": [
            "commonjs",
            "module",
            [
                "typescript",
                {
                    "project": "tsconfig.build.json",
                    "tsc": "../../node_modules/typescript/bin/tsc"
                }
            ]
        ]
    }
}

Reproducible demo

Building or syncing the project returns these errors

IshmeetSingh06 avatar May 24 '25 21:05 IshmeetSingh06