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

feat(android): add support for AGP 8 #48

Merged
merged 1 commit into from Nov 20, 2023

Conversation

AndreiCalazans
Copy link
Contributor

Change to support AGP 8 as mentioned here: react-native-community/discussions-and-proposals#671

This does not remove package attribute from AndroidManifest to not lose compatibility with AGP < 8 (React Native < 0.71 versions).

I don't think it's worth maintaining logic to remove that attribute contitionally since it will only cause a warning to users on AGP 8 and above.

@FelipeSSantos1
Copy link

@LinusU Any plan to merge that?

Copy link
Contributor

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there 👋 - this is a good fix, it's what I'm using locally in a patch-package as I test android gradle plugin 8 compatibility

I'm also the maintainer of react-native-netinfo, react-native-device-info, react-native-firebase, and a pile of other ones, they all need this and work well with exactly this patch

Cheers

@mikehardy
Copy link
Contributor

worth noting react-native 0.73 - which will require this - is on rc4 now and will release very soon

@felipecsl
Copy link

I feel like a broken record at this point, but you'll need to remove the package attribute from AndroidManifest.xml as well

@mikehardy
Copy link
Contributor

mikehardy commented Nov 18, 2023

No you don't actually @felipecsl - if you remove package from AndroidManifest, then you will be on-purpose breaking folks that are still on android gradle plugin 6 and below, which is to say everyone on react-native 0.66 and below. That may be something you are willing to do, but it is not necessary.

If you leave the package attribute in AndroidManifest you get a warning. Not an error, things still build.
If you remove the package attribute in AndroidManifest you no longer get a warning on android gradle plugin 7+ but you will have broken android-gradle-plugin 6 and below

To me anyway, the choice is obvious, leave it in, let it warn.

@felipecsl
Copy link

@mikehardy that doesn’t match what I saw, unfortunately. The package attribute does cause a build error instead of a warning. I can pull up a log message for you if you’re still unsure, but I’m 100% certain about it.
I realize it’s a breaking change, but if you bump the major version and make it clear in the change log it shouldn’t be a problem

@mikehardy
Copy link
Contributor

I'm 100% certain the opposite. Literally building just fine with this patch package as is, same in all packages. I maintain a large number of repositories including react-native-firebase with this solution published same style and hundreds of thousands of downloads

No problems

You'll need to provide evidence

@felipecsl
Copy link

@mikehardy oh I think I know what might be happening. My project is on RN 72 and AGP 8, I’m on my phone now but I believe RN 73 added a backport for libraries that still have the package attribute to make it still work, while RN 72 might not have that. Does that match your understanding?

@mikehardy
Copy link
Contributor

No.

The version skew of my react-native-firebase (and react-native-device-info, and react-native-netinfo) library consumers certainly includes every version you imagine

You need to provide evidence to back your assertion.

I have repos with the changes in form proposed here published and download counts on versions that contain the change style proposed here to back my assertion

@felipecsl
Copy link

felipecsl commented Nov 18, 2023

@mikehardy you're right, I apologize. For some reason I can't reproduce the issue right now, at least not with react-native-get-random-values. I'll try to isolate it to figure out a consistent repro and will update here if so

@mikehardy
Copy link
Contributor

No reason to apologize, I like a good technical argument. My 100% statement was a bit bold as yes I do have strong evidence but software always manages to surprise us doesn't it? If there is some combination where it does not work I will be very interested to know the details since I have pushed these same PRs out in lots of repositories and support tons of users. If there is some edge case I'm bound to have a user hit it...

@felipecsl
Copy link

Appreciate the work you’re doing sir 👍🏽

@LinusU
Copy link
Owner

LinusU commented Nov 20, 2023

Sorry for the late reply on this one!

I'm ready to merge, just wanted to double check one final thing: as I've read the discussion here, this would not be a breaking change. Is my understanding of this correct?

Thank you 🙏

@felipecsl
Copy link

That’s my understanding as well

@LinusU
Copy link
Owner

LinusU commented Nov 20, 2023

Looked at react-native-netinfo and it seems like they released this as a non-breaking change, so let's go 🚀

@LinusU LinusU merged commit 46c37a8 into LinusU:master Nov 20, 2023
@LinusU
Copy link
Owner

LinusU commented Nov 20, 2023

Released as 🚢 1.10.0 / 2023-11-20

@mikehardy
Copy link
Contributor

Fantastic! You released sooner than I can reply but anyway I was the one that did the netinfo release and I've released same for quite a few other heavily used packages, so far totally non-breaking. Cheers

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.

None yet

5 participants