Skip to content

Fail on Android debug build / :react-native-community_datetimepicker:packageDebugResources FAILED  #810

Closed
@crisbal

Description

@crisbal

Bug report

Summary

I am trying to run a debug release of my react-native app. It is a freshly created app with react-native 0.72.4 and gradle 8.

I have never used Gradle so I am not fully sure if the issue is on me and my Gradle setup or something on your side.

I am on Windows, I have installed your library via npm and then followed the manual-installation procedure

I have no idea why it complains about this task dependency and if that is the real problem.

Note (but I guess off-topic): I have had the library build successfully with gradle 7 (by setting distributionUrl in android\gradle\wrapper\gradle-wrapper.properties to gradle 7), but the "production" build would fail.

 ❯❯❯ cat android/settings.gradle
rootProject.name = 'TimeSince'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
include ':@react-native-community_datetimepicker'
project(':@react-native-community_datetimepicker').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/datetimepicker/android')


 ❯❯❯ cat android/app/src/main/java/com/timesince/MainApplication.java | grep "Picker"
import com.reactcommunity.rndatetimepicker.RNDateTimePickerPackage;
          packages.add(new RNDateTimePickerPackage());

 ❯❯❯ cat android/app/build.gradle
[omitted]
dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")
    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }
    implementation project(':@react-native-community_datetimepicker')
}
[omitted]

Output of the build process

> Task :gradle-plugin:compileKotlin UP-TO-DATE
> Task :gradle-plugin:compileJava NO-SOURCE
> Task :gradle-plugin:pluginDescriptors UP-TO-DATE
> Task :gradle-plugin:processResources UP-TO-DATE
> Task :gradle-plugin:classes UP-TO-DATE
> Task :gradle-plugin:jar UP-TO-DATE
> Task :gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE
> Task :@react-native-community_datetimepicker:preBuild UP-TO-DATE
> Task :@react-native-community_datetimepicker:preDebugBuild UP-TO-DATE
> Task :@react-native-community_datetimepicker:compileDebugAidl NO-SOURCE
> Task :@react-native-community_datetimepicker:compileDebugRenderscript NO-SOURCE
> Task :@react-native-community_datetimepicker:generateDebugBuildConfig UP-TO-DATE
> Task :@react-native-community_datetimepicker:generateDebugResValues UP-TO-DATE
> Task :@react-native-community_datetimepicker:generateDebugResources UP-TO-DATE
> Task :@react-native-community_datetimepicker:packageDebugResources UP-TO-DATE
> Task :@react-native-community_datetimepicker:parseDebugLocalResources UP-TO-DATE
> Task :@react-native-community_datetimepicker:processDebugManifest UP-TO-DATE
> Task :@react-native-community_datetimepicker:generateDebugRFile UP-TO-DATE
> Task :@react-native-community_datetimepicker:javaPreCompileDebug UP-TO-DATE

> Task :@react-native-community_datetimepicker:compileDebugJavaWithJavac

> Task :app:buildCodegenCLI SKIPPED
> Task :app:generateCodegenSchemaFromJavaScript SKIPPED
> Task :app:generateCodegenArtifactsFromSchema SKIPPED
> Task :app:generatePackageList
> Task :app:preBuild
> Task :app:preDebugBuild
> Task :react-native-community_datetimepicker:preBuild UP-TO-DATE
> Task :react-native-community_datetimepicker:preDebugBuild UP-TO-DATE
> Task :react-native-community_datetimepicker:compileDebugAidl NO-SOURCE
> Task :react-native-safe-area-context:preBuild UP-TO-DATE
> Task :react-native-safe-area-context:preDebugBuild UP-TO-DATE
> Task :react-native-safe-area-context:compileDebugAidl NO-SOURCE
> Task :react-native-screens:preBuild UP-TO-DATE
> Task :react-native-screens:preDebugBuild UP-TO-DATE
> Task :react-native-screens:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :@react-native-community_datetimepicker:packageDebugRenderscript NO-SOURCE
> Task :react-native-community_datetimepicker:packageDebugRenderscript NO-SOURCE
> Task :react-native-safe-area-context:packageDebugRenderscript NO-SOURCE
> Task :react-native-screens:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :@react-native-community_datetimepicker:compileDebugLibraryResources UP-TO-DATE
> Task :@react-native-community_datetimepicker:writeDebugAarMetadata UP-TO-DATE
> Task :react-native-community_datetimepicker:writeDebugAarMetadata UP-TO-DATE
> Task :react-native-safe-area-context:writeDebugAarMetadata UP-TO-DATE
> Task :react-native-screens:writeDebugAarMetadata UP-TO-DATE
> Task :@react-native-community_datetimepicker:bundleLibCompileToJarDebug
> Task :app:checkDebugAarMetadata UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :react-native-community_datetimepicker:compileDebugRenderscript NO-SOURCE
> Task :react-native-community_datetimepicker:generateDebugResValues UP-TO-DATE
> Task :react-native-community_datetimepicker:generateDebugResources UP-TO-DATE
> Task :react-native-community_datetimepicker:packageDebugResources FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.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/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings
26 actionable tasks: 4 executed, 22 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':react-native-community_datetimepicker:packageDebugResources' (type 'MergeResources').
  - Gradle detected a problem with the following location: 'C:\Users\bldcr\Desktop\projects\TimeSince\node_modules\@react-native-community\datetimepicker\android\build\generated\res\rs\debug'.

    Reason: Task ':react-native-community_datetimepicker:packageDebugResources' uses this output of task ':@react-native-community_datetimepicker: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-community_datetimepicker:compileDebugRenderscript' as an input of ':react-native-community_datetimepicker:packageDebugResources'.        
      2. Declare an explicit dependency on ':@react-native-community_datetimepicker:compileDebugRenderscript' from ':react-native-community_datetimepicker:packageDebugResources' using Task#dependsOn.
      3. Declare an explicit dependency on ':@react-native-community_datetimepicker:compileDebugRenderscript' from ':react-native-community_datetimepicker: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: 'C:\Users\bldcr\Desktop\projects\TimeSince\node_modules\@react-native-community\datetimepicker\android\build\generated\res\resValues\debug'.

    Reason: Task ':react-native-community_datetimepicker:packageDebugResources' uses this output of task ':@react-native-community_datetimepicker: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-community_datetimepicker:generateDebugResValues' as an input of ':react-native-community_datetimepicker:packageDebugResources'.
      2. Declare an explicit dependency on ':@react-native-community_datetimepicker:generateDebugResValues' from ':react-native-community_datetimepicker:packageDebugResources' using Task#dependsOn.
      3. Declare an explicit dependency on ':@react-native-community_datetimepicker:generateDebugResValues' from ':react-native-community_datetimepicker: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.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s

Environment info

Please ignore the NoSDK thing. I can compile without react-native-datetimepicker/datetimepicker just fine.

npx react-native info output:

>>> .\node_modules\.bin\react-native info
info Fetching system and libraries information...
System:
  OS: Windows 10 10.0.19045
  CPU: "(12) x64 AMD Ryzen 5 3600 6-Core Processor              "
  Memory: 3.54 GB / 15.93 GB
Binaries:
  Node:
    version: 18.17.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 9.6.7
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-223.8836.35.2231.10671973
  Visual Studio: Not Found
Languages:
  Java: 11.0.20
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

react-native doctor

> .\node_modules\.bin\react-native doctor
Common
 ✓ Node.js - Required to execute JavaScript code
 ✓ npm - Required to install NPM dependencies

Android
 ✓ Adb - Required to verify if the android device is attached correctly
 ✓ JDK - Required to compile Java code
 ✓ Android Studio - Required for building and installing your app on Android
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 33.0.0
 ✓ ANDROID_HOME - Environment variable that points to your Android SDK installation

package.json

"dependencies": {
    "@react-native-community/datetimepicker": "^7.5.0",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "@types/uuid": "^9.0.3",
    "react": "18.2.0",
    "react-native": "0.72.4",
    "react-native-safe-area-context": "^4.7.2",
    "react-native-screens": "^3.25.0",
    "uuid": "^9.0.0",
    "zustand": "^4.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/eslint-config": "^0.72.2",
    "@react-native/metro-config": "^0.72.11",
    "@tsconfig/react-native": "^3.0.0",
    "@types/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.76.8",
    "prettier": "^2.4.1",
    "react-test-renderer": "18.2.0",
    "typescript": "4.8.4"
  },
  "engines": {
    "node": ">=16"
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions