Search code examples
androidreact-nativebuild.gradleyarnpkgbuilding

Task :app:bundleDevReleaseJsAndAssets FAILED


When i try to run cd android ./gradlew assemleRelease

This is terminal output

Task :app:bundleDevReleaseJsAndAssets warning: the transform cache was reset. Welcome to Metro v0.72.3 Fast - Scalable - Integrated

info Writing bundle output to:, C:\Users\CABBAR\Documents\github repo\TarifistClient\android\app\build\generated\assets\react\dev\release\index.android.bundle info Writing sourcemap output to:, C:\Users\CABBAR\Documents\github repo\TarifistClient\android\app\build\intermediates\sourcemaps\react\dev\release\index.android.bundle.packager.map info Done writing bundle output info Done writing sourcemap output info Copying 286 asset files info Done copying assets 'C:\Users\CABBAR\Documents\github' is not recognized as an internal or external command, operable program or batch file.

Task :app:bundleDevReleaseJsAndAssets FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where: Script 'C:\Users\CABBAR\Documents\github repo\TarifistClient\node_modules\react-native\react.gradle' line: 286

  • What went wrong: Execution failed for task ':app:bundleDevReleaseJsAndAssets'.

Process 'command 'cmd'' finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

2: Task failed with an exception.

  • What went wrong: java.lang.StackOverflowError (no error message)

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BU¦LD FAILED in 1m 29s 6 actionable tasks: 1 executed, 5 up-to-date PS C:\Users\CABBAR\Documents\github repo\TarifistClient\android>



i have tried :
`cd android` `./gradlew --stop` `./gradlew clean` and
also deleted node_modules and loaded again with `yarn install`
after that when i run `cd android `
`./gradlew assemleRelease` it still same problem.

// also i tried this command `react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res` but terminal gibing this error: 

react-native: The term 'react-native' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.


Solution

  • when i want to get a build without this error 'Task :app:bundleDevReleaseJsAndAssets FAILED'. i am running this code on root project.

    npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res 
    

    after delete last builds (for any crash):// Daha önce alınan buildleri temizler - Clears previous builds

    cd android
    ./gradlew clean
    

    we have a 2 build types in android > build.gradle file so i can get a build in two types also my error is caused by that. So when i want to get a build on Develop i need to run this command on root > android

                    **DEVELOP**
    

    //apk build’i için - for apk build

    ./gradlew assembleDevRelease -x bundleDevReleaseJsAndAssets 
    

    //aab build’i için - for abb build

    ./gradlew bundleDevRelease -x bundleDevReleaseJsAndAssets
    
                    **PRODUCTION**
    

    //apk build’i için - for apk build

    ./gradlew assembleProdRelease -x bundleProdReleaseJsAndAssets 
    

    //aab build’i için - for abb build

    ./gradlew bundleProdRelease -x bundleProdReleaseJsAndAssets 
    

    and just wait without erRor i hope. D:

    After build you can discard new created files.