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

AndroidX support for react-native 0.60 #263

Merged
merged 1 commit into from
Apr 24, 2020
Merged

Conversation

yfuks
Copy link
Contributor

@yfuks yfuks commented Jul 26, 2019

Hi,

this is a breaking change
should be published under a new major version

@yfuks yfuks mentioned this pull request Jul 26, 2019
@gunnartorfis
Copy link

gunnartorfis commented Jul 28, 2019

Is there anything we can do to get this merged sooner? The repo hasn't been updated for 2 months.

Have you found any workarounds building your Android app @yfuks? AppCenter always fails to build for me.

> Task :react-native-calendar-events:compileReleaseJavaWithJavac FAILED /Users/vsts/agent/2.154.3/work/1/s/node_modules/react-native-calendar-events/android/src/main/java/com/calendarevents/CalendarEvents.java:14: error: cannot find symbol import android.support.v4.app.ActivityCompat;

@yfuks
Copy link
Contributor Author

yfuks commented Jul 28, 2019

Is there anything we can do to get this merged sooner? The repo hasn't been updated for 2 months.

I don't have any access to this repo. Just need @wmcmahan to take time and review.

Have you found any workarounds building your Android app @yfuks? AppCenter always fails to build for me.

No i don't. But you could try using jetifier

@jeveloper
Copy link

Time to fork this library and say goodbye
Stop ignoring @wmcmahan , Come on Will
AndroidX is now a MUST for RN 60, 61

thanks

@mikehardy
Copy link
Contributor

mikehardy commented Sep 12, 2019

Ok, so -

1- it would be nice if this project was active but being a maintainer is hard. I just checked the forks and there are no active forks. If it was easy there'd be one right? If someone else wanted to take this up, that would be great of course.
2- jetifier works great on this module, I use it with react-native 0.60. In fact it is included by default in the execution of react-native init now, so, no worries. Also, I am the jetifier maintainer (which is why I know item 1 above is true, and I mention it so you can trust I know this item is also true)

Just remember it is easy to criticize but it's hard to do the work. At the same time, it is rewarding so if anyone feels like giving this a go fork and it and start merging some of these old pull requests.

@mikehardy
Copy link
Contributor

Also, there's always patch-package (I just patched this locally to tolerate read-only calendar access for instance, and it worked great)

@GioLogist
Copy link

Just to confirm, as @mikehardy mentioned, jetifier also worked for me 👍🏻

    "react-native": "0.61.5",
    "react-native-calendar-events": "^1.7.3",

@MoOx MoOx mentioned this pull request Jan 13, 2020
@stereodenis
Copy link

@wmcmahan ?

@Copser
Copy link

Copser commented Jan 16, 2020

Is there a chance that we merge this?

I can't use jetifier and it would be easier for everyone, thanks

@jeremyeaton89
Copy link

jeremyeaton89 commented Apr 6, 2020

Is there a chance that we merge this?

I can't use jetifier and it would be easier for everyone, thanks

what he said! @wmcmahan 🙏 :)

@mikehardy
Copy link
Contributor

Just out of curiosity, as jetifier maintainer, why not use jetifier? (I mean, it literally runs by default in the CLI now - is there something tragically wrong with it in your project? I know there is a pending wish that there was exclusion capability, maybe that would help?)

@jeremyeaton89
Copy link

@mikehardy fewer pre/post install steps the better imho.

@mikehardy
Copy link
Contributor

Agreed. But that's preference ("fewer is better") not necessity ("I can't"). Working software is better than preference of course.

Don't get me wrong, I want things natively AndroidX. PRs to do so should merge. I was just fishing for any "I can't because..." reasons. Those are things to do. Preferences are just things to talk about ;-)

@Copser
Copy link

Copser commented Apr 7, 2020

@mikehardy fair enough, the project was on 0.57 react native when he came to me and after upgrade to 0.59 jetifier is broken and can't upgrade all the packages like this library, and a couple more so I needed to check with the maintainer and see are they willing to give support for anrdoidx, don't get me wrong I love using expo just because of this things, but can't with this one but you are right with

Working software is better than preference of course.

I'm sorry for my approach, I should explain why rather then just I can't.

@mikehardy
Copy link
Contributor

jetifier is broken and can't upgrade all the packages like this library

Well, you're in luck :-), this library is one of the ones I use personally and I'm the jetifier maintainer, it really should work, it does for me. If you can show me a reproducible example of jetifier not working, I'll do my best to fix it. The jetifier repo is quiet not because I'm not listening just that there hasn't been anything to do for months. Happy to fix any bugs ASAP

@MoOx MoOx merged commit 835903b into wmcmahan:master Apr 24, 2020
@MoOx
Copy link
Collaborator

MoOx commented Apr 24, 2020

Thanks for the patience (I have been added as a maintainer for this repo).
Will cut a new major release "one day" :)

@mikehardy
Copy link
Contributor

@MoOx hey! Welcome to the party :-)

@DMezhenskyi
Copy link

DMezhenskyi commented Apr 27, 2020

@mikehardy Which version of react native are you using? I was trying with RN 0.62.2 and jetifier enabled but I have the same issue.. Do you have any example how did you configure it? I was trying to follow this instructions and also without this manual steps but without luck. Thanks

@mikehardy
Copy link
Contributor

@mezhik91 It has worked in every version above RN59. I'm currently 0.62.2 yes. I have "the same issue" - as a maintainer I hate that phrase :-). Everyone thinks they have the same issue, and so frequently everyone has different issues. I strongly prefer all the relevant versions and the text of an error message.

For this module, at this point, all you should do is yarn add react-native-calendar-events - but I will note that I use it in combination with https://github.com/react-native-community/react-native-permissions to manage the permissions.

@SudoPlz
Copy link

SudoPlz commented Jun 18, 2020

Hey there, I'm wondering if there's a way to use this today.
Any specific reason why a new major version is not getting released now that this is merged?

@MoOx
Copy link
Collaborator

MoOx commented Jun 18, 2020

@SudoPlz take a look to https://github.com/mikehardy/jetifier until I find some time to test latest merged changes (nobody really maintain this package, I asked for proper rights but I am having hard time to dedicate some time for this package)

@mikehardy
Copy link
Contributor

As I mentioned above:

I use this package personally in work projects
I maintain jetifier

So I'll make sure this module runs. And it runs :-)

If that is still not good enough for your personal situation, behold the magical patch-package: https://github.com/ds300/patch-package

I do actually use patch-package on this particular module but not for AndroidX conversion, I use it to remove the need for calendar write permission. Also works great.

@bruxalldev
Copy link

Hi here's my build log with errors this package worked fine for the last 5 releases but won't build today.
class ActivityCompat is obviously not being found - how do I make this work on RN 0.61

Task :react-native-calendar-events:compileReleaseJavaWithJavac FAILED
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
/PATH_TO/node_modules/react-native-calendar-events/android/src/main/java/com/calendarevents/CalendarEvents.java:14: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
/PATH_TO/node_modules/react-native-calendar-events/android/src/main/java/com/calendarevents/CalendarEvents.java:15: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
/PATH_TO/node_modules/react-native-calendar-events/android/src/main/java/com/calendarevents/CalendarEvents.java:71: error: cannot find symbol
ActivityCompat.requestPermissions(currentActivity, new String[]{
^
symbol: variable ActivityCompat
location: class CalendarEvents
/PATH_TO/node_modules/react-native-calendar-events/android/src/main/java/com/calendarevents/CalendarEvents.java:95: error: cannot find symbol
int writePermission = ContextCompat.checkSelfPermission(reactContext, Manifest.permission.WRITE_CALENDAR);
^
symbol: variable ContextCompat
location: class CalendarEvents
/PATH_TO/node_modules/react-native-calendar-events/android/src/main/java/com/calendarevents/CalendarEvents.java:96: error: cannot find symbol
int readPermission = ContextCompat.checkSelfPermission(reactContext, Manifest.permission.READ_CALENDAR);
^
symbol: variable ContextCompat
location: class CalendarEvents
5 errors
3 warnings

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-calendar-events:compileReleaseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

@mikehardy
Copy link
Contributor

@bruxalldev by reading this thread perhaps and applying the solution provided? (hint: it's using jetifier)

@bruxalldev
Copy link

@mikehardy thanks I see now what I need to do:

For others reading this if you have RN ^6.0 run npx jetify before you do a build works like a charm!

@mikehardy
Copy link
Contributor

Yes - if you are running gradle manually for whatever reason you will want to run npx jetify before you do that. Ideally you run it then as package.json::postinstall step so you never forget and it only has to run once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.