Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANDROID: Task :@react-native-community_datetimepicker:compileDebugJavaWithJavac FAILED #11

Closed
shettayyy opened this issue Jul 22, 2019 · 20 comments

Comments

@shettayyy
Copy link

shettayyy commented Jul 22, 2019

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:100: 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.

  • What went wrong:
    Execution failed for task ':@react-native-community_datetimepicker:compileDebugJavaWithJavac'.

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
@Swaagie Swaagie added bug Something isn't working help wanted Extra attention is needed labels Jul 31, 2019
@Swaagie
Copy link
Collaborator

Swaagie commented Jul 31, 2019

@rashtay thanks for reporting. What version of Gradle did you use to build your app?

In an ideal world the components do not use any deprecated API methods, but I'm not that intimate with the development of the language itself to know first hand what replaces each method.

Most of this code has been directly ported from the code base of React Native itself. Hence I wonder if there is a version discrepancy here. I'll try to reproduce first local. It might just be the 0.60 upgrade, for which there is work in progress, see #13

@shettayyy
Copy link
Author

@rashtay thanks for reporting. What version of Gradle did you use to build your app?

In an ideal world the components do not use any deprecated API methods, but I'm not that intimate with the development of the language itself to know first hand what replaces each method.

Most of this code has been directly ported from the code base of React Native itself. Hence I wonder if there is a version discrepancy here. I'll try to reproduce the first local. It might just be the 0.60 upgrades, for which there is work in progress, see #13

@Swaagie com.android.tools.build:gradle:3.4.2

I hope this helps. Do let me know if you need clarity on anything else.

@Swaagie
Copy link
Collaborator

Swaagie commented Aug 13, 2019

@rashtay I've just published @react-native-community/datetimepicker@2.0.0 which works against React Native 0.60, let me know if that resolves your build issues.

@QuintonC
Copy link

QuintonC commented Sep 6, 2019

@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

@arslanrazzaq
Copy link

@Swaagie i try to use the ^2.0.0 version but i'm getting same error as @rashtay .

@wasim-abuzaher
Copy link

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

@skurgansky-sugarcrm
Copy link

skurgansky-sugarcrm commented Sep 30, 2019

Do your android detox tests work ?
I tried and it failed. I was wondering how you managed to setup detox skipping build integration and it supposed to work. Looks like not.

> Task :app:compileDebugAndroidTestJavaWithJavac FAILED
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:3: error: package com.wix.detox does not exist
import com.wix.detox.Detox;
                    ^
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:5: error: package org.junit does not exist
import org.junit.Rule;
                ^
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:6: error: package org.junit does not exist
import org.junit.Test;
                ^
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:7: error: package org.junit.runner does not exist
import org.junit.runner.RunWith;
                       ^
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:9: error: package androidx.test.ext.junit.runners does not exist
import androidx.test.ext.junit.runners.AndroidJUnit4;
                                      ^
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:10: error: package androidx.test.filters does not exist
import androidx.test.filters.LargeTest;
                            ^
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:11: error: package androidx.test.rule does not exist
import androidx.test.rule.ActivityTestRule;
                         ^
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:13: error: cannot find symbol
@RunWith(AndroidJUnit4.class)                                                                                                                                                               ^
  symbol: class RunWith
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:14: error: cannot find symbol
@LargeTest
 ^
  symbol: class LargeTest
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:18: error: cannot find symbol
    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
           ^
  symbol:   class ActivityTestRule
  location: class DetoxTest
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:17: error: cannot find symbol
    @Rule
     ^
  symbol:   class Rule
  location: class DetoxTest
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:20: error: cannot find symbol
    @Test
     ^
  symbol:   class Test
  location: class DetoxTest
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:18: error: cannot find symbol
    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
                                                              ^
  symbol:   class ActivityTestRule
  location: class DetoxTest
/Users/ksv/Downloads/react-native-datetimepicker-master/example/android/app/src/androidTest/java/com/example/DetoxTest.java:22: error: cannot find symbol
        Detox.runTests(mActivityRule);
        ^
  symbol:   variable Detox
  location: class DetoxTest
14 errors

@suhask-iprogrammer
Copy link

@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

@ventr1x
Copy link

ventr1x commented Nov 25, 2019

Another broken plugin it seems. Same issue, no chance to compile the app with gradle

@hardywu
Copy link

hardywu commented Dec 12, 2019

Facing same issue. Thought tt works on IOS.

@mrriyous
Copy link

Facing same issue. Is there any solutions for this ?

@swalahamani
Copy link

Same issue. Any work around?

@eightyfive
Copy link

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 ??

@mikehardy
Copy link

@eightyfive
Copy link

I had no idea this existed. I'll give it a try. Thanks @mikehardy.

@zeabdelkhalek
Copy link

Try to migrate to AndroidX

@jvgaeta
Copy link

jvgaeta commented Jan 16, 2020

@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
Copy link

Great to hear that works! Note that I am a huge proponent of moving to AndroidX + react-native 0.60. It is painful. But the auto-linking stuff and cocoapods, they do justify the pain. In the meantime, understanding the pain, I'll keep jetifier working (forwards and backwards) so we can all get work done. Cheers

@jvgaeta
Copy link

jvgaeta commented Jan 16, 2020

@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!

@vonovak
Copy link
Member

vonovak commented Jan 30, 2020

closing, please use the solution from #11 (comment) or upgrade to RN >= 0.60

@vonovak vonovak closed this as completed Jan 30, 2020
@react-native-datetimepicker react-native-datetimepicker locked and limited conversation to collaborators Jan 30, 2020
@vonovak vonovak removed bug Something isn't working help wanted Extra attention is needed labels Jan 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests