react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.45k stars 273 forks source link

[BUG] [Android] Task uses output of task without declaring an explicit or implicit dependency #518

Closed jesuscc1993 closed 10 months ago

jesuscc1993 commented 10 months ago

Context

I'm trying to upgrade to RN 0.72, using the upgrade helper. However, the Android build fails with the following error:

error.log ``` FAILURE: Build completed with 5 failures. 1: Task failed with an exception. ----------- * What went wrong: Some problems were found with the configuration of task ':react-native-picker_picker:packageDebugResources' (type 'MergeResources'). - Gradle detected a problem with the following location: '[REDACTED]/node_modules/@react-native-picker/picker/android/build/generated/res/rs/debug'. Reason: Task ':react-native-picker_picker:packageDebugResources' uses this output of task ':@react-native-picker_picker:compileDebugRenderscript' 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: 1. Declare task ':@react-native-picker_picker:compileDebugRenderscript' as an input of ':react-native-picker_picker:packageDebugResources'. 2. Declare an explicit dependency on ':@react-native-picker_picker:compileDebugRenderscript' from ':react-native-picker_picker:packageDebugResources' using Task#dependsOn. 3. Declare an explicit dependency on ':@react-native-picker_picker:compileDebugRenderscript' from ':react-native-picker_picker:packageDebugResources' using Task#mustRunAfter. Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem. - Gradle detected a problem with the following location: '[REDACTED]/node_modules/@react-native-picker/picker/android/build/generated/res/resValues/debug'. Reason: Task ':react-native-picker_picker:packageDebugResources' uses this output of task ':@react-native-picker_picker:generateDebugResValues' 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: 1. Declare task ':@react-native-picker_picker:generateDebugResValues' as an input of ':react-native-picker_picker:packageDebugResources'. 2. Declare an explicit dependency on ':@react-native-picker_picker:generateDebugResValues' from ':react-native-picker_picker:packageDebugResources' using Task#dependsOn. 3. Declare an explicit dependency on ':@react-native-picker_picker:generateDebugResValues' from ':react-native-picker_picker:packageDebugResources' using Task#mustRunAfter. Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem. * 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: Some problems were found with the configuration of task ':@react-native-picker_picker:extractDeepLinksDebug' (type 'ExtractDeepLinksTask'). - Gradle detected a problem with the following location: '[REDACTED]/node_modules/@react-native-picker/picker/android/build/generated/res/rs/debug/navigation'. Reason: Task ':@react-native-picker_picker:extractDeepLinksDebug' uses this output of task ':react-native-picker_picker:compileDebugRenderscript' 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: 1. Declare task ':react-native-picker_picker:compileDebugRenderscript' as an input of ':@react-native-picker_picker:extractDeepLinksDebug'. 2. Declare an explicit dependency on ':react-native-picker_picker:compileDebugRenderscript' from ':@react-native-picker_picker:extractDeepLinksDebug' using Task#dependsOn. 3. Declare an explicit dependency on ':react-native-picker_picker:compileDebugRenderscript' from ':@react-native-picker_picker:extractDeepLinksDebug' using Task#mustRunAfter. Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem. - Gradle detected a problem with the following location: '[REDACTED]/node_modules/@react-native-picker/picker/android/build/generated/res/resValues/debug/navigation'. Reason: Task ':@react-native-picker_picker:extractDeepLinksDebug' uses this output of task ':react-native-picker_picker:generateDebugResValues' 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: 1. Declare task ':react-native-picker_picker:generateDebugResValues' as an input of ':@react-native-picker_picker:extractDeepLinksDebug'. 2. Declare an explicit dependency on ':react-native-picker_picker:generateDebugResValues' from ':@react-native-picker_picker:extractDeepLinksDebug' using Task#dependsOn. 3. Declare an explicit dependency on ':react-native-picker_picker:generateDebugResValues' from ':@react-native-picker_picker:extractDeepLinksDebug' using Task#mustRunAfter. Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem. * 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. ============================================================================== 3: Task failed with an exception. ----------- * What went wrong: Some problems were found with the configuration of task ':react-native-picker_picker:extractDeepLinksDebug' (type 'ExtractDeepLinksTask'). - Gradle detected a problem with the following location: '[REDACTED]/node_modules/@react-native-picker/picker/android/build/generated/res/rs/debug/navigation'. Reason: Task ':react-native-picker_picker:extractDeepLinksDebug' uses this output of task ':@react-native-picker_picker:compileDebugRenderscript' 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: 1. Declare task ':@react-native-picker_picker:compileDebugRenderscript' as an input of ':react-native-picker_picker:extractDeepLinksDebug'. 2. Declare an explicit dependency on ':@react-native-picker_picker:compileDebugRenderscript' from ':react-native-picker_picker:extractDeepLinksDebug' using Task#dependsOn. 3. Declare an explicit dependency on ':@react-native-picker_picker:compileDebugRenderscript' from ':react-native-picker_picker:extractDeepLinksDebug' using Task#mustRunAfter. Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem. - Gradle detected a problem with the following location: '[REDACTED]/node_modules/@react-native-picker/picker/android/build/generated/res/resValues/debug/navigation'. Reason: Task ':react-native-picker_picker:extractDeepLinksDebug' uses this output of task ':@react-native-picker_picker:generateDebugResValues' 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: 1. Declare task ':@react-native-picker_picker:generateDebugResValues' as an input of ':react-native-picker_picker:extractDeepLinksDebug'. 2. Declare an explicit dependency on ':@react-native-picker_picker:generateDebugResValues' from ':react-native-picker_picker:extractDeepLinksDebug' using Task#dependsOn. 3. Declare an explicit dependency on ':@react-native-picker_picker:generateDebugResValues' from ':react-native-picker_picker:extractDeepLinksDebug' using Task#mustRunAfter. Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem. * 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. ============================================================================== 4: Task failed with an exception. ----------- * What went wrong: A problem was found with the configuration of task ':react-native-picker_picker:packageDebugAssets' (type 'MergeSourceSetFolders'). - Gradle detected a problem with the following location: '[REDACTED]/node_modules/@react-native-picker/picker/android/build/intermediates/shader_assets/debug/out'. Reason: Task ':react-native-picker_picker:packageDebugAssets' uses this output of task ':@react-native-picker_picker:compileDebugShaders' 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: 1. Declare task ':@react-native-picker_picker:compileDebugShaders' as an input of ':react-native-picker_picker:packageDebugAssets'. 2. Declare an explicit dependency on ':@react-native-picker_picker:compileDebugShaders' from ':react-native-picker_picker:packageDebugAssets' using Task#dependsOn. 3. Declare an explicit dependency on ':@react-native-picker_picker:compileDebugShaders' from ':react-native-picker_picker:packageDebugAssets' using Task#mustRunAfter. Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem. * 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. ============================================================================== 5: Task failed with an exception. ----------- * What went wrong: A problem was found with the configuration of task ':react-native-picker_picker:copyDebugJniLibsProjectOnly' (type 'LibraryJniLibsTask'). - Gradle detected a problem with the following location: '[REDACTED]/node_modules/@react-native-picker/picker/android/build/intermediates/merged_native_libs/debug/out'. Reason: Task ':react-native-picker_picker:copyDebugJniLibsProjectOnly' uses this output of task ':@react-native-picker_picker:mergeDebugNativeLibs' 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: 1. Declare task ':@react-native-picker_picker:mergeDebugNativeLibs' as an input of ':react-native-picker_picker:copyDebugJniLibsProjectOnly'. 2. Declare an explicit dependency on ':@react-native-picker_picker:mergeDebugNativeLibs' from ':react-native-picker_picker:copyDebugJniLibsProjectOnly' using Task#dependsOn. 3. Declare an explicit dependency on ':@react-native-picker_picker:mergeDebugNativeLibs' from ':react-native-picker_picker:copyDebugJniLibsProjectOnly' using Task#mustRunAfter. Please refer to https://docs.gradle.org/8.0.1/userguide/validation_problems.html#implicit_dependency for more details about this problem. * 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. ```

To give a brief summary, several tasks fail because they depend on the result of other tasks without declaring this dependency (at least that's what I understand based on the log).

react-native info

info.log ``` System: OS: macOS 13.4.1 CPU: (8) x64 Apple M1 Pro Memory: 15.66 MB / 32.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 16.20.2 path: /var/folders/2_/_4ngbvyj55s3yc47kp_57wx80000gn/T/yarn--1693318725003-0.5548305867466561/node Yarn: version: 1.22.19 path: /var/folders/2_/_4ngbvyj55s3yc47kp_57wx80000gn/T/yarn--1693318725003-0.5548305867466561/yarn npm: version: 8.19.4 path: ~/.nvm/versions/node/v16.20.2/bin/npm Watchman: Not Found Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms: - DriverKit 22.2 - iOS 16.2 - macOS 13.1 - tvOS 16.1 - watchOS 9.1 Android SDK: API Levels: - "33" Build Tools: - 33.0.0 System Images: - android-33 | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10406996 Xcode: version: 14.2/14C18 path: /usr/bin/xcodebuild Languages: Java: version: 1.8.0_332 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.3 wanted: 0.72.3 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false ```

Other versions

jesuscc1993 commented 10 months ago

We were able to fix this. There was some leftover deprecated Android setup that needed to be removed:

android/app/build.gradle

implementation project(':@react-native-picker_picker')

android/settings.gradle

include ':@react-native-picker_picker'  
project(':@react-native-picker_picker').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-picker/picker/android')

All credit for the fix goes to my colleague @jguix.