'React Native Execution optimizations have been disabled for tasks sudden error

So i was creating a react-native app and started working on it and everything is fine but suddenly these errors appeared from no where when i reloaded my app , the application on emulator keeps crashing when ever i try to build it

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:14068) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 873 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...

> Configure project :app
WARNING:: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.

> Task :app:processDebugMainManifest
Execution optimizations have been disabled for task ':app:processDebugMainManifest' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\navigation_json\debug\navigation.json'. Reason: Task ':app:processDebugMainManifest' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :app:processDebugManifest
Execution optimizations have been disabled for task ':app:processDebugManifest' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\compatible_screen_manifest\debug'. Reason: Task ':app:processDebugManifest' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\merged_manifest\debug\AndroidManifest.xml'. Reason: Task ':app:processDebugManifest' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :app:compressDebugAssets
Execution optimizations have been disabled for task ':app:compressDebugAssets' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\merged_assets\debug\out'. Reason: Task ':app:compressDebugAssets' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :app:processDebugManifestForPackage
Execution optimizations have been disabled for task ':app:processDebugManifestForPackage' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\merged_manifests\debug'. Reason: Task ':app:processDebugManifestForPackage' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :app:mergeLibDexDebug
Execution optimizations have been disabled for task ':app:mergeLibDexDebug' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\duplicate_classes_check\debug'. Reason: Task ':app:mergeLibDexDebug' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :app:mergeDebugJavaResource
Execution optimizations have been disabled for task ':app:mergeDebugJavaResource' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\java_res\debug\out'. Reason: Task ':app:mergeDebugJavaResource' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :app:mergeExtDexDebug
Execution optimizations have been disabled for task ':app:mergeExtDexDebug' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\duplicate_classes_check\debug'. Reason: Task ':app:mergeExtDexDebug' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\external_file_lib_dex_archives\debug'. Reason: Task ':app:mergeExtDexDebug' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :app:mergeDebugNativeLibs
Execution optimizations have been disabled for task ':app:mergeDebugNativeLibs' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\merged_jni_libs\debug\out'. Reason: Task ':app:mergeDebugNativeLibs' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :app:stripDebugDebugSymbols
Execution optimizations have been disabled for task ':app:stripDebugDebugSymbols' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\IDEAPAD\Desktop\react-native\zoom\android\app\build\intermediates\merged_native_libs\debug\out'. Reason: Task ':app:stripDebugDebugSymbols' uses this output of task ':app:copyDebugReactNativeVectorIconFonts' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
Unable to strip the following libraries, packaging them as they are: libbetter.so, libc++_shared.so, libevent-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libfabricjni.so, libfb.so, libfbjni.so, libflipper.so, libfolly_futures.so, libfolly_json.so, libglog.so, libglog_init.so, libimagepipeline.so, libjsc.so, libjscexecutor.so, libjsi.so, libjsijniprofiler.so, libjsinspector.so, liblogger.so, libmapbufferjni.so, libnative-filters.so, libnative-imagetranscoder.so, libreact_codegen_rncore.so, libreact_debug.so, libreact_nativemodule_core.so, libreact_render_animations.so, libreact_render_attributedstring.so, libreact_render_componentregistry.so, libreact_render_core.so, libreact_render_debug.so, libreact_render_graphics.so, libreact_render_imagemanager.so, libreact_render_leakchecker.so, libreact_render_mapbuffer.so, libreact_render_mounting.so, libreact_render_runtimescheduler.so, libreact_render_scheduler.so, libreact_render_telemetry.so, libreact_render_templateprocessor.so, libreact_render_textlayoutmanager.so, libreact_render_uimanager.so, libreact_utils.so, libreactconfig.so, libreactnativeblob.so, libreactnativejni.so, libreactnativeutilsjni.so, libreactperfloggerjni.so, librrc_image.so, librrc_modal.so, librrc_progressbar.so, librrc_root.so, librrc_scrollview.so, librrc_slider.so, librrc_switch.so, librrc_text.so, librrc_textinput.so, librrc_unimplementedview.so, librrc_view.so, libturbomodulejsijni.so, libyoga.so.

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Pixel_4_XL_API_30(AVD) - 11' for app:debug
Installed on 1 device.

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.2/userguide/command_line_interface.html#sec:command_line_warnings

Execution optimizations have been disabled for 9 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.

I dont know what's happening. Is there any solution for this ?



Solution 1:[1]

I had a similar problem (on Java 17), and got fix by the following steps:

7.4.2 is the latest gradle version at the time of this post

1- change distributionUrl on android/gradle/wrapper/gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

2- change gradel version to 7.0.0 from android/build.gradle:

...    
    dependencies {
        classpath("com.android.tools.build:gradle:7.0.0")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

Also (in mac or linux):

cd android

chmod +x gradlew

According to Github Issues In case of OutOfMemoryError issue, add the following line to the end of android/gradle.properties:

org.gradle.jvmargs=-Xmx1536M

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jay