Skip to content

Fix build for Gradle >8.5 and modern build tools#226

Open
Groxx wants to merge 3 commits intoandroid-rcs:masterfrom
Groxx:master
Open

Fix build for Gradle >8.5 and modern build tools#226
Groxx wants to merge 3 commits intoandroid-rcs:masterfrom
Groxx:master

Conversation

@Groxx
Copy link
Copy Markdown

@Groxx Groxx commented Nov 7, 2025

A few changes rolled into one to get this project into a "you can open it in the current Android Studio and it can build and run tests" state.

I have NOT been doing Android work consistently over the past 10 years that this project has existed though, so I'm not 100% confident about this PR.
It works for me and I've tried to make reasonably sure everything is correct, but major build-system upgrades like this tend to have a lot of subtle surprises that are hard to learn about years afterward :\

So I, personally, would be happy enough using this - it seems functional enough and nobody should be depending on this project in any sensitive way. But obviously the final decision is yours, and I have no solid evidence that it's actually correct :)


seems-definitely-required changes:

  • compile -> implements dependency-type rename
  • << -> doLast, as << is fully removed now
  • copied the AndroidManifest.xml namespace into the relevant build.gradle files, and updated the manifest.srcFile because apparently the default location has moved and it wasn't finding most
  • enabled AIDL build feature in libs/api/... (the only sub-project that needs it)
  • removed a test-only AndroidManifest.xml namespace, as the build tools said that wasn't allowed. unfortunately I'm not sure if this has any consequences, but even if it does it seems almost certainly limited to test-related activities? like at worst it might replace the non-test app rather than installing along-side it.
  • switch(...) { case R.id.xyz -> if (... == R.id.xyz) automated rewrite via Android Studio's refactor tool
    • I forget when this changed, but R.id.xyz is no longer a build-time constant, so it cannot be used in a switch statement. There might be a way to change the build to restore this, but my brief attempts didn't work, and it didn't seem worth spending more effort on when I have an automated rewriter.
    • I have not carefully checked all of these, but as it's not an AI tool I feel it's probably trustworthy, and it seems to work
    • only one needed to be rewritten by hand, onOptionsItemSelected in RI/src/com/gsma/rcs/ri/messaging/TalkList.java
  • explicit paths to manifest.srcFile when needed in build.gradle files, as the default location has moved
    • it's likely better to move those files to the new default location, but I'm trying to be minimal and I'm not sure how to be confident that it'll be a safe no-op.
  • upgraded gradle to a relatively-modern version
  • upgraded build tools, as the IDE was telling me that the older version was being ignored
    • I have not checked if this has any other important impacts, but it can build and run tests with no noteworthy warnings so it seems likely fine

other minor non-functional changes that I happened to see:

  • some indentation changes in files that also had other changes, e.g. R.id switch rewrites.
    • these were made by a brand new Android Studio install on Linux with absolutely no customization, so they feel pretty likely to be stable. it's easy to undo if you'd prefer to do a separate "modernize indents in all code" commit or something though.
  • all \t characters in build.gradle files changed to four spaces, and whitespace trailers removed, to be consistent.
    • it was making diffs annoying to read, so I just normalized it all after the fourth one.
  • assertEquals args on a test I happened to look at were backwards, so I swapped them (should be expected, actual).
    • this was done by android studio's "swap arguments" refactor, and tests passed both before and after, and it looks reasonable at a glance. pretty sure it's correct.

A somewhat annoyingly large set of changes for review purposes (sorry!), but I've tried to keep it fairly reasonable and limited in focus.

I'm still trying to find any other problems I may have missed, but I can run the testUnitDebugTest gradle target successfully now, except for emulator-run tests that require a telephony stack (other in-emulator tests succeed).

Steven added 3 commits November 7, 2025 00:01
…d in switches by AS-replacing them with if statements.

With the exception of:
```
    public boolean onOptionsItemSelected(MenuItem item) {
```
in RI/src/com/gsma/rcs/ri/messaging/TalkList.java, all switch refactors were done automatically via Android Studio's "rewrite switch statement as ifs".
A cursory glance looks correct and I generally trust non-ai refactors so I think that's sufficient, but I have not actually checked them carefully.
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.

1 participant