react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Gradle "Implicit dependencies between tasks" warning on fresh install

Open williamgurzoni opened this issue 3 years ago • 33 comments

Description

Multiple warnings on a fresh React Native project during Android Release build.

The warnings are related with Implicit Dependencies.

Eg.

Execution optimizations have been disabled for task ':app:copyReleaseBundledJs' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '<path>/PocDependency/android/app/build/intermediates'. Reason: Task ':app:analyticsRecordingRelease' uses this output of task ':app:copyReleaseBundledJs' 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.

Please see full log on code example.

Thank you.

Version

0.67.3

Output of npx react-native info

npx react-native info
info Fetching system and libraries information...
System:
    OS: macOS 12.2.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 179.91 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.9.1 - ~/.nvm/versions/node/v16.9.1/bin/node
    Yarn: 1.22.17 - ~/.yarn/bin/yarn
    npm: 7.21.1 - ~/.nvm/versions/node/v16.9.1/bin/npm
    Watchman: 2021.12.13.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK:
      API Levels: 25, 26, 28, 29, 30, 31
      Build Tools: 25.0.3, 28.0.3, 29.0.2, 29.0.3, 30.0.2
      System Images: android-21 | Google APIs Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7486908
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_251 - /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.67.3 => 0.67.3
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. npx react-native init ProjectName
  2. cd ProjectName
  3. npx react-native run-android --variant release

Snack, code example, screenshot, or link to a repository

npx react-native run-android --variant release output:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...

> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
                    Welcome to Metro!
              Fast - Scalable - Integrated


info Writing bundle output to:, /Users/william/Documents/projects/temp/PocDependency/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /Users/william/Documents/projects/temp/PocDependency/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 1 asset files
info Done copying assets

> Task :app:copyReleaseBundledJs
Execution optimizations have been disabled for task ':app:copyReleaseBundledJs' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates'. Reason: Task ':app:analyticsRecordingRelease' uses this output of task ':app:copyReleaseBundledJs' 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:processReleaseMainManifest
Execution optimizations have been disabled for task ':app:processReleaseMainManifest' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/navigation_json/release/navigation.json'. Reason: Task ':app:processReleaseMainManifest' uses this output of task ':app:copyReleaseBundledJs' 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.
[androidx.vectordrawable:vectordrawable-animated:1.0.0] /Users/william/.gradle/caches/transforms-3/5232169e73d4423ea21d51876a2d84b1/transformed/vectordrawable-animated-1.0.0/AndroidManifest.xml Warning:
        Package name 'androidx.vectordrawable' used in: androidx.vectordrawable:vectordrawable-animated:1.0.0, androidx.vectordrawable:vectordrawable:1.0.1.

> Task :app:processReleaseManifest
Execution optimizations have been disabled for task ':app:processReleaseManifest' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/compatible_screen_manifest/release'. Reason: Task ':app:processReleaseManifest' uses this output of task ':app:copyReleaseBundledJs' 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: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/merged_manifest/release/AndroidManifest.xml'. Reason: Task ':app:processReleaseManifest' uses this output of task ':app:copyReleaseBundledJs' 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:compressReleaseAssets
Execution optimizations have been disabled for task ':app:compressReleaseAssets' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/merged_assets/release/out'. Reason: Task ':app:compressReleaseAssets' uses this output of task ':app:copyReleaseBundledJs' 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:sdkReleaseDependencyData
Execution optimizations have been disabled for task ':app:sdkReleaseDependencyData' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/metadata_library_dependencies_report/release/dependencies.pb'. Reason: Task ':app:sdkReleaseDependencyData' uses this output of task ':app:copyReleaseBundledJs' 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:processReleaseManifestForPackage
Execution optimizations have been disabled for task ':app:processReleaseManifestForPackage' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/merged_manifests/release'. Reason: Task ':app:processReleaseManifestForPackage' uses this output of task ':app:copyReleaseBundledJs' 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:mergeReleaseJavaResource
Execution optimizations have been disabled for task ':app:mergeReleaseJavaResource' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/java_res/release/out'. Reason: Task ':app:mergeReleaseJavaResource' uses this output of task ':app:copyReleaseBundledJs' 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:mergeExtDexRelease
Execution optimizations have been disabled for task ':app:mergeExtDexRelease' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/duplicate_classes_check/release'. Reason: Task ':app:mergeExtDexRelease' uses this output of task ':app:copyReleaseBundledJs' 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: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/external_file_lib_dex_archives/release'. Reason: Task ':app:mergeExtDexRelease' uses this output of task ':app:copyReleaseBundledJs' 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:mergeReleaseNativeLibs
Execution optimizations have been disabled for task ':app:mergeReleaseNativeLibs' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/merged_jni_libs/release/out'. Reason: Task ':app:mergeReleaseNativeLibs' uses this output of task ':app:copyReleaseBundledJs' 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:stripReleaseDebugSymbols
Execution optimizations have been disabled for task ':app:stripReleaseDebugSymbols' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/william/Documents/projects/temp/PocDependency/android/app/build/intermediates/merged_native_libs/release/out'. Reason: Task ':app:stripReleaseDebugSymbols' uses this output of task ':app:copyReleaseBundledJs' 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, libfabricjni.so, libfb.so, libfbjni.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:installRelease
Installing APK 'app-release.apk' on 'SM-T355Y - 7.1.1' for app:release
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 10 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.

BUILD SUCCESSFUL in 51s
37 actionable tasks: 37 executed
info Connecting to the development server...
info Starting the app on "147642cb"...
Starting: Intent { cmp=com.pocdependency/.MainActivity launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } }

williamgurzoni avatar Mar 01 '22 23:03 williamgurzoni

Facing the Same Issue. Same Version and Same Release Error in React Native. Pleas guide. Thank You

Rehan-05 avatar Mar 02 '22 09:03 Rehan-05

Yup we're aware of this (cc @ShikaSD). It's a new warning that Gradle introduced, so far it's not affecting the build output, but we'll look into finding a different approach to fix it.

cortinico avatar Mar 02 '22 23:03 cortinico

Same issue, it is scary and very noisy, but the final build seems ok.

Please, I really hope this doesn't mean upgrading native dependencies one by one to fix / correct a gradle config issue, but rather a global fix from RN.

cristianoccazinsp avatar Mar 22 '22 17:03 cristianoccazinsp

Please, I really hope this doesn't mean upgrading native dependencies one by one to fix / correct a gradle config issue, but rather a global fix from RN.

Yes this is addressable as a fix from our end.

it is scary and very noisy,

Agree that is noisy, but is nothing to worry about. This is just Gradle mentioning that it can't parallelize the build further, as there are two tasks writing to the same folder. The final output won't be affected

cortinico avatar Mar 26 '22 15:03 cortinico

same issue

sunshinelancer828 avatar Apr 08 '22 15:04 sunshinelancer828

Same version, same warnings, does anyone found the solution?

anwersolangi avatar Apr 11 '22 15:04 anwersolangi

My Android bundle being generated is not updating with new code changes and these warnings are always showing up.

paramsinghvc avatar Apr 11 '22 22:04 paramsinghvc

Same Issue

arjun1194 avatar Apr 15 '22 17:04 arjun1194

Same issue, apk is build from Vs but not from android studio

drb1 avatar Apr 19 '22 18:04 drb1

Same error but for me, it affects the build (even for a recently created react-native project), when changed to android folder, and then run the command "./gradlew assembleRelease" to build an apk. The errors are released, the apk is generated, but dynamic interactions as links or requests for apis doesn't work.

raf2019 avatar May 03 '22 21:05 raf2019

Same issue

fondue-tech avatar May 04 '22 08:05 fondue-tech

same for me but app crashed on build...

coolusaHD avatar May 06 '22 16:05 coolusaHD

Same for me when I run ./gradlew assembleRelease, how did you fix this problem?

EmanueleAgo avatar May 14 '22 17:05 EmanueleAgo

Same issue for react-native 0.67.0

goodryanboy avatar May 19 '22 12:05 goodryanboy

Same issue for RN 0.68 :/ I agree that probably is an issue of RN

PamelinaDu avatar May 24 '22 23:05 PamelinaDu

same for me but app crashed on build...

Crashing on build here as well. Were you able to find any work around?

airowe avatar Jun 01 '22 21:06 airowe

Hi, there is no problem in the development environment, but when I get the release build, the app crashes. (Android) I created a new project (v0.68.2), I didn't make any changes, the room crashed in the same way.

bloggerklik avatar Jun 09 '22 15:06 bloggerklik

How are we going to solve it, is it impossible at the moment?

zekoliman avatar Jun 13 '22 12:06 zekoliman

It may be useful for you if the app is crashing. https://stackoverflow.com/a/72567127/19309011

bloggerklik avatar Jun 13 '22 13:06 bloggerklik

so many issues with react native, we are thinking of dropping it for flutter or jetpack compose

arjun1194 avatar Jun 15 '22 08:06 arjun1194

Having to spend quite a bit of time fixing all kinds of build pipeline issues like this kinda sucks. This is happening because the phase for adding in the index.android.bundle isn't working correctly. It appears that file gets created correctly, but doesn't end up in the actual APK/AAB since when a gradle update comes out, the copy/merge process is slightly different. Working on a workaround now...

Update: I thought those warnings were affecting my release build, but it turned out they weren't. Once I worked past the missing bundle issue (instant app crash, info below) I had a grey screen on initial release install. That grey screen is equivalent to the red exception page in dev mode. To troubleshoot, open logcat in Android Studio, install release build through Webstorm (or whatever IDE you use), clear logcat, open app, then search for 'error' in logcat. That should give you the trace to what is causing the js exception.

As far as the bundle issue, the short-term fix seems to be to just run './gradlew bundleRelease' twice. After that, build:release:android and install:release:android appear to work fine.

dmacpro91 avatar Jun 15 '22 23:06 dmacpro91

This causes our release build to fail when using React Native Sentry's Gradle plugin.

jliuhtonen avatar Jun 29 '22 09:06 jliuhtonen

Any update on this?

chipcop106 avatar Jul 01 '22 10:07 chipcop106

Same issue on KMM based project. seems like just a warning and beyond RN

sud007 avatar Jul 15 '22 18:07 sud007

This causes our release build to fail

As mentioned by @sud007, that's a warning. It's unlikely this is causing your build to fail.

cortinico avatar Jul 29 '22 16:07 cortinico

When will it be fixed ? it clutters the whole terminal and is even worse when flavors enabled. It is in many many files and in many expo packages. Build times increased but isn't affecting final build.

sheikx1221 avatar Aug 21 '22 17:08 sheikx1221

Any updates on this? my app literally crashes on release builds.

anassbenayed avatar Aug 23 '22 17:08 anassbenayed

System: OS: macOS 12.2.1 CPU: (8) arm64 Apple M1 Memory: 95.58 MB / 8.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.16.0 - /opt/homebrew/opt/node@16/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 8.11.0 - /opt/homebrew/opt/node@16/bin/npm Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Not Found Android SDK: API Levels: 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.0 System Images: android-33 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: /undefined - /usr/bin/xcodebuild Languages: Java: 11.0.16 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.69.3 => 0.69.3 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

After upgrading to React Native 0.69.3, Running app on debug mode works fine, but when Release is assembled, some of the code doesn't work, thought bundle got generated with "./gradlew app:assembleRelease"

code76kb avatar Aug 24 '22 13:08 code76kb

Build times increased but isn't affecting final build.

As mentioned, this is a warning, not an error.

When will it be fixed ?

THis is under our radar and it's going to be fixed in the near future.

cortinico avatar Sep 16 '22 15:09 cortinico

Build times increased but isn't affecting final build.

As mentioned, this is a warning, not an error.

When will it be fixed ?

THis is under our radar and it's going to be fixed in the near future.

@cortinico seems like you did focus on "Build times increased" instead of actual issue which is:

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.

So yes, technically it is a "warning" but it can also cause unexpected results and should be prioritized properly.

rumax avatar Oct 12 '22 13:10 rumax