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

build is failing (Task :datadog_mobile-react-native:runKtlintCheckOverMainSourceSet FAILED) #762

Open
kapilw360 opened this issue Jan 1, 2025 · 2 comments

Comments

@kapilw360
Copy link

kapilw360 commented Jan 1, 2025

Im using RN 0.76.5 version
and "@datadog/mobile-react-native": "^2.4.4"

getting below error

Task :datadog_mobile-react-native:runKtlintCheckOverMainSourceSet FAILED

FAILURE: Build failed with an exception.

What went wrong: A problem was found with the configuration of task ':datadog_mobile-react-native:runKtlintCheckOverMainSourceSet' (type 'KtLintCheckTask').
Gradle detected a problem with the following location: '/Users/kapil/Desktop/w360-app-v4/node_modules/@datadog/mobile-react-native/android/build/generated/source/codegen/java'.

Reason: Task ':datadog_mobile-react-native:runKtlintCheckOverMainSourceSet' uses this output of task ':datadog_mobile-react-native:generateCodegenArtifactsFromSchema' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

Possible solutions:

Declare task ':datadog_mobile-react-native:generateCodegenArtifactsFromSchema' as an input of ':datadog_mobile-react-native:runKtlintCheckOverMainSourceSet'.
Declare an explicit dependency on ':datadog_mobile-react-native:generateCodegenArtifactsFromSchema' from ':datadog_mobile-react-native:runKtlintCheckOverMainSourceSet' using Task#dependsOn.
Declare an explicit dependency on ':datadog_mobile-react-native:generateCodegenArtifactsFromSchema' from ':datadog_mobile-react-native:runKtlintCheckOverMainSourceSet' using Task#mustRunAfter.

below is my build.gradle file

apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

/**
 * This is the configuration block to customize your React Native Android app.
 * By default you don't need to apply any configuration, just uncomment the lines you need.
 */
react {
    /* Folders */
    //   The root of your project, i.e. where "package.json" lives. Default is '../..'
    // root = file("../../")
    //   The folder where the react-native NPM package is. Default is ../../node_modules/react-native
    // reactNativeDir = file("../../node_modules/react-native")
    //   The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
    // codegenDir = file("../../node_modules/@react-native/codegen")
    //   The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
    // cliFile = file("../../node_modules/react-native/cli.js")

    /* Variants */
    //   The list of variants to that are debuggable. For those we're going to
    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.
    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
    // debuggableVariants = ["liteDebug", "prodDebug"]

    /* Bundling */
    //   A list containing the node command and its flags. Default is just 'node'.
    // nodeExecutableAndArgs = ["node"]
    //
    //   The command to run when bundling. By default is 'bundle'
    // bundleCommand = "ram-bundle"
    //
    //   The path to the CLI configuration file. Default is empty.
    // bundleConfig = file(../rn-cli.config.js)
    //
    //   The name of the generated asset file containing your JS bundle
    // bundleAssetName = "MyApplication.android.bundle"
    //
    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
    // entryFile = file("../js/MyApplication.android.js")
    //
    //   A list of extra flags to pass to the 'bundle' commands.
    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
    // extraPackagerArgs = []

    /* Hermes Commands */
    //   The hermes compiler command to run. By default it is 'hermesc'
    // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
    //
    //   The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
    // hermesFlags = ["-O", "-output-source-map"]

      /* Autolinking */
    autolinkLibrariesWithApp()
}

/**
 * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
 */
def enableProguardInReleaseBuilds = true

/**
 * The preferred build flavor of JavaScriptCore (JSC)
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US. Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' ] // Specify font files
]

android {
    ndkVersion rootProject.ext.ndkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    compileSdk rootProject.ext.compileSdkVersion

    namespace "com.wellness360.app"
    defaultConfig {
        applicationId "com.wellness360.app"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 38
        versionName "1.0"
    }
      externalNativeBuild {
        cmake {
            // path "src/main/cpp/CMakeLists.txt"
            version "3.31.1"
        }
    }

    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            // shrinkResources enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
                unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
            }
        }
    }
    packagingOptions {
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libjsc.so'
        pickFirst 'lib/arm64-v8a/libjsc.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
   }
}

dependencies {
    
    // The version of react-native is set by the React Native Gradle Plugin
    // implementation("com.google.firebase:firebase-core")
    //implementation project(':rn-samsung-health')
    // implementation("com.facebook.react:flipper-integration")
    implementation "com.facebook.react:react-native:+" // From node_modules
    implementation("com.facebook.react:react-android")
    implementation "androidx.work:work-runtime-ktx:2.8.1"
    implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
    implementation("com.google.firebase:firebase-crashlytics")
    implementation("com.google.firebase:firebase-analytics")
    implementation("com.google.firebase:firebase-messaging")
    implementation project(':react-native-inappbrowser-reborn')

    implementation project(':react-native-vector-icons')
    implementation "androidx.health.connect:connect-client:1.1.0-alpha06"

    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }
}
repositories {
    mavenCentral()
    google()
    maven { url "$rootDir/../node_modules/react-native/android" }
}

apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")

afterEvaluate {
    tasks.named('generateDebugLintReportModel').configure {
        dependsOn tasks.named('copyReactNativeVectorIconFonts')
    }

    tasks.named('lintAnalyzeDebug').configure {
        dependsOn tasks.named('copyReactNativeVectorIconFonts')
    }

    tasks.named('generateReleaseLintReportModel').configure {
        dependsOn tasks.named('copyReactNativeVectorIconFonts')
    }

    tasks.named('lintAnalyzeRelease').configure {
        dependsOn tasks.named('copyReactNativeVectorIconFonts')
    }
}
@marco-saia-datadog
Copy link
Member

Hello @kapilw360 👋

Sorry for the long wait.

We are working in order to provide full support for RN 0.76 and we will keep you posted here.

In the meantime, would you mind sharing your package.json and gradle.properties?

I am also curious to see which version of gradle-wrapper you are currently using; could you please check the distributionUrl in your android/gradle/wrapper/gradle-wrapper.properties file?

Thank you!

@kapilw360
Copy link
Author

Hello @kapilw360 👋

Sorry for the long wait.

We are working in order to provide full support for RN 0.76 and we will keep you posted here.

In the meantime, would you mind sharing your package.json and gradle.properties?

I am also curious to see which version of gradle-wrapper you are currently using; could you please check the distributionUrl in your android/gradle/wrapper/gradle-wrapper.properties file?

Thank you!

sure. currently i have removed datadog dependency.

below is the package.json file.
{
"name": "wellness360",
"version": "0.0.1",
"IOS_VERSION": "1.25",
"IOS_BUILD_NUMBER": "0",
"ANDROID_VERSION": "1.0",
"ANDROID_BUILD_NUMBER": "40",
"private": true,
"scripts": {
"prepare": "husky",
"postinstall": "husky && patch-package",
"lint-staged": "lint-staged",
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"lint-error": "eslint --quiet .",
"code-format": "prettier . --write",
"start": "react-native start",
"test": "jest",
"type-check": "tsc",
"test:report": "jest --collectCoverage --coverageDirectory="./coverage" --ci --reporters=default --reporters=jest-junit --coverage",
"pod-install": "cd ios && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install && cd ..",
"bundle:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'",
"check-updates": "yarn dlx npm-check-updates"
},
"lint-staged": {
".{js,jsx,ts,tsx}": [
"eslint",
"prettier --write"
],
".{css,scss,md,html}": [
"prettier --write"
]
},
"dependencies": {
"@gluestack-style/react": "^1.0.57",
"@gluestack-ui/config": "^1.1.19",
"@gluestack-ui/themed": "^1.1.50",
"@notifee/react-native": "^7.8.2",
"@react-native-async-storage/async-storage": "^2.1.0",
"@react-native-community/slider": "^4.5.5",
"@react-native-firebase/analytics": "^21.6.1",
"@react-native-firebase/app": "^21.6.1",
"@react-native-firebase/crashlytics": "^21.6.1",
"@react-native-firebase/messaging": "^21.6.1",
"@react-native-masked-view/masked-view": "^0.3.2",
"@react-native/gradle-plugin": "0.76.3",
"@react-navigation/bottom-tabs": "^7.2.0",
"@react-navigation/drawer": "^7.1.1",
"@react-navigation/native": "^7.0.14",
"@react-navigation/native-stack": "^7.2.0",
"@react-navigation/stack": "^7.1.1",
"@reduxjs/toolkit": "^2.3.0",
"add": "^2.0.6",
"async-mutex": "^0.5.0",
"base-64": "^1.0.0",
"formik": "^2.4.6",
"globals": "^15.13.0",
"i18next": "^24.0.2",
"lodash": "^4.17.21",
"lottie-react-native": "^6.7.2",
"lucide-react-native": "^0.462.0",
"mixpanel-react-native": "^3.0.8",
"moment": "^2.30.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-fast-compare": "^3.2.2",
"react-i18next": "^15.1.2",
"react-native": "0.76.3",
"react-native-blob-util": "^0.19.11",
"react-native-calendars": "^1.1307.0",
"react-native-circular-progress": "^1.4.1",
"react-native-date-picker": "^5.0.7",
"react-native-device-info": "^14.0.1",
"react-native-document-picker": "^9.3.1",
"react-native-file-viewer": "^2.1.5",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.21.2",
"react-native-health": "^1.19.0",
"react-native-health-connect": "^3.3.1",
"react-native-htmlview": "^0.17.0",
"react-native-image-crop-picker": "^0.41.6",
"react-native-inappbrowser-reborn": "^3.7.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-mmkv": "^3.1.0",
"react-native-pdf": "^6.7.5",
"react-native-reanimated": "3.16.3",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "^4.14.0",
"react-native-screens": "^4.1.0",
"react-native-sound": "^0.11.2",
"react-native-svg": "^15.9.0",
"react-native-vector-icons": "^10.2.0",
"react-native-video": "^6.8.2",
"react-native-webview": "^13.12.4",
"react-native-youtube-iframe": "^2.3.0",
"react-redux": "^9.1.2",
"react-test-renderer": "^18.3.1",
"redux-persist": "^6.0.0",
"url": "^0.11.4",
"victory-native": "^36.9.2-next.3",
"yup": "^1.4.0"
},
"resolutions": {
"react-dom": "18.3.1",
"@types/react": "^18.3.1",
"react-native": "0.76.3",
"react-native-reanimated": "3.16.3"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.5",
"@react-native/eslint-config": "0.76.5",
"@react-native/metro-config": "0.76.5",
"@react-native/typescript-config": "0.76.5",
"@react-navigation/devtools": "^7.0.14",
"@tsconfig/react-native": "^3.0.5",
"@types/base-64": "^1",
"@types/lodash": "^4",
"@types/react": "^18.2.6",
"@types/react-dom": "^18",
"@types/react-native-htmlview": "^0.16.5",
"@types/react-native-vector-icons": "^6.4.18",
"@types/react-native-video": "^5.0.20",
"@types/react-redux": "^7.1.34",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/eslint-plugin-tslint": "^7.0.2",
"@typescript-eslint/parser": "^7.16.1",
"babel-jest": "^29.7.0",
"babel-plugin-inline-dotenv": "^1.7.0",
"babel-plugin-module-resolver": "^5.0.2",
"dotenv": "^16.4.5",
"eslint": "^8.19.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-react-app": "^7.0.1",
"eslint-config-react-native": "^4.1.0",
"eslint-plugin-ft-flow": "^3.0.11",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.4",
"eslint-plugin-react-hooks": "^4.6.2",
"husky": "^9.1.7",
"jest": "^29.7.0",
"lint-staged": "^15.2.10",
"patch-package": "^8.0.0",
"prettier": "3.4.1",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
},
"packageManager": "[email protected]"
}

================================
gradle.properties

org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

org.gradle.parallel=true

android.useAndroidX=true

android.enableJetifier=true

./gradlew -PreactNativeArchitectures=x86_64
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64

newArchEnabled=true

hermesEnabled=true

================================
gradle-wrapper.properties

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

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

No branches or pull requests

2 participants