datetimepicker: ANDROID: Task :@react-native-community_datetimepicker:compileDebugJavaWithJavac FAILED

Bug

Task :@react-native-community_datetimepicker:compileDebugJavaWithJavac FAILED /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java:24: error: package androidx.fragment.app does not exist import androidx.fragment.app.DialogFragment; ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java:28: error: cannot find symbol public class RNDatePickerDialogFragment extends DialogFragment { ^ symbol: class DialogFragment /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogModule.java:14: error: package androidx.fragment.app does not exist import androidx.fragment.app.FragmentActivity; ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogModule.java:15: error: package androidx.fragment.app does not exist import androidx.fragment.app.FragmentManager; ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogFragment.java:18: error: package androidx.fragment.app does not exist import androidx.fragment.app.DialogFragment; ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogFragment.java:27: error: cannot find symbol public class RNTimePickerDialogFragment extends DialogFragment { ^ symbol: class DialogFragment /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogModule.java:14: error: package androidx.fragment.app does not exist import androidx.fragment.app.DialogFragment; ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogModule.java:15: error: package androidx.fragment.app does not exist import androidx.fragment.app.FragmentActivity; ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogModule.java:16: error: package androidx.fragment.app does not exist import androidx.fragment.app.FragmentManager; ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java:36: error: method does not override or implement a method from a supertype @Override ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java:38: error: cannot find symbol Bundle args = getArguments(); ^ symbol: method getArguments() location: class RNDatePickerDialogFragment /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java:39: error: cannot find symbol instance = createDialog(args, getActivity(), mOnDateSetListener); ^ symbol: method getActivity() location: class RNDatePickerDialogFragment /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java:122: error: method does not override or implement a method from a supertype @Override ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java:124: error: cannot find symbol super.onDismiss(dialog); ^ symbol: variable super location: class RNDatePickerDialogFragment /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogModule.java:104: error: cannot find symbol FragmentActivity activity = (FragmentActivity) getCurrentActivity(); ^ symbol: class FragmentActivity location: class RNDatePickerDialogModule /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogModule.java:104: error: cannot find symbol FragmentActivity activity = (FragmentActivity) getCurrentActivity(); ^ symbol: class FragmentActivity location: class RNDatePickerDialogModule /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogModule.java:112: error: cannot find symbol FragmentManager fragmentManager = activity.getSupportFragmentManager(); ^ symbol: class FragmentManager location: class RNDatePickerDialogModule /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogModule.java:129: error: cannot find symbol fragment.setArguments(createFragmentArguments(options)); ^ symbol: method setArguments(Bundle) location: variable fragment of type RNDatePickerDialogFragment /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogFragment.java:35: error: method does not override or implement a method from a supertype @Override ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogFragment.java:37: error: cannot find symbol final Bundle args = getArguments(); ^ symbol: method getArguments() location: class RNTimePickerDialogFragment /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogFragment.java:38: error: cannot find symbol instance = createDialog(args, getActivity(), mOnTimeSetListener); ^ symbol: method getActivity() location: class RNTimePickerDialogFragment /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogFragment.javašŸ’Æ error: method does not override or implement a method from a supertype @Override ^ /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogFragment.java:102: error: cannot find symbol super.onDismiss(dialog); ^ symbol: variable super location: class RNTimePickerDialogFragment /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogModule.java:78: error: cannot find symbol FragmentActivity activity = (FragmentActivity) getCurrentActivity(); ^ symbol: class FragmentActivity location: class RNTimePickerDialogModule /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogModule.java:78: error: cannot find symbol FragmentActivity activity = (FragmentActivity) getCurrentActivity(); ^ symbol: class FragmentActivity location: class RNTimePickerDialogModule /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogModule.java:87: error: cannot find symbol FragmentManager fragmentManager = activity.getSupportFragmentManager(); ^ symbol: class FragmentManager location: class RNTimePickerDialogModule /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNTimePickerDialogModule.java:104: error: cannot find symbol fragment.setArguments(createFragmentArguments(options)); ^ symbol: method setArguments(Bundle) location: variable fragment of type RNTimePickerDialogFragment Note: /Users/rahshett/localshiva/QuickCare/node_modules/@react-native-community/datetimepicker/android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 27 errors

FAILURE: Build failed with an exception.

Compilation failed; see the compiler error output for details.

  • 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use ā€˜ā€“warning-mode allā€™ to show the individual deprecation warnings. See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 11s 19 actionable tasks: 11 executed, 8 up-to-date error Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.

Environment info

  React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
      Memory: 273.63 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
      npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 26, 27, 28
        Build Tools: 28.0.3
        System Images: android-26 | Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5692245
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.6 => 16.8.6
      react-native: ^0.59.8 => 0.59.8
    npmGlobalPackages:
      react-native-cli: 2.0.1

Library version: ^1.0.0

Steps To Reproduce

  1. npm i @react-native-community/datetimepicker
  2. npm link @react-native-community/datetimepicker
  3. react-native run-android ā€¦

Describe what you expected to happen:

  1. App to install successfully in the Emulator

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 14
  • Comments: 20 (1 by maintainers)

Most upvoted comments

@Swaagie Facing same issue, using v^2.0.0 ā€œreact-nativeā€: ā€œ0.59.5ā€ ā€œGradleā€: 3.4.1

Error: Task: react-native-datetimepicker:compileDebugJavaWithJavac FAILED

Facing same issue, using v^2.0.0 and "react-native": "0.59.5"

Execution failed for task ':react-native-datetimepicker:compileDebugJavaWithJavac'.

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

@Swaagie @2.0.0 is not working for me. Iā€™m getting the same issue as above.

Screen Shot 2019-09-06 at 10 20 17 AM

@mikehardy Thanks for the tip! Got it working by doing:

  1. rm -rf node_modules
  2. npm install
  3. npx jetify -r
  4. npm run android:build

@mikehardy We will definitely migrate shortly. We developed on expokit, which turned out to be a mistake and will be migrating off of that as well since it prevents us from upgrading to the newest RN version. Weā€™re just too close to launch right now to do any major migrations. Thanks again!

I had no idea this existed. Iā€™ll give it a try. Thanks @mikehardy.

RNDatePickerDialogFragment.java is trying to import from AndroidX:

import androidx.fragment.app.DialogFragment;

So it seems like react-native-datetimepicker does not support react-native < 0.60 ??