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

Upgrade Gradle and AGP from 7.x to 8.x and use Java 17 #10035

Merged
merged 4 commits into from
Apr 20, 2023

Conversation

Stypox
Copy link
Member

@Stypox Stypox commented Apr 20, 2023

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

Android Studio Flamingo just came out and it asked me to upgrade to Gradle 8.0, so I just ran its upgrade assistant. The version of Gradle it brought me to was 8.0, so I manually set it to 8.1 and it works fine. I also had to manually set the correct distributionSha256Sum taken from here.

The release notes for Gradle 8.0 are here, for 8.1 here, and release notes for all versions can be found here. I didn't find anything relevant for us in the release notes.

As per Android Gradle Plugin, here are the release notes. The "namespace" breaking change does not affect us as we are already setting namespace "org.schabi.newpipe" under android {. Other breaking changes have to do with default values, and an interesting one might be the R class now having non-final resource IDs by default. Since the app builds fine (I tried to build after a gradle clean), I guess all of these changes have not broken our build.

I pushed a third commit adding a JVM argument to gradle.properties, otherwise the build will just crash with this strange error message. Previously I avoided this issue by using Gradle with Java 11, but Java 11 is not supported by Gradle 8.1 anymore, and higher Java versions give this error (I tried 17 and 19). I have no idea where this came from and by searching on the internet I only found bug reports about tools we don't use, although the common temporary solution for these kind of messages just seems to be adding --add-opens jdk.compiler/PACKAGE_NAME=ALL-UNNAMED (where PACKAGE_NAME in this case is com.sun.tools.javac.model).

class clojure.lang.Reflector cannot access class com.sun.tools.javac.model.JavacElements (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.model to unnamed module

Now compileOptions and kotlinOptions use JDK 17 (the version shipped with Android Studio by default) instead of JDK 11 to adapt to JDK 11 not being valid anymore. The CI failed for the same reason, so I also updated it to use JDK 17. While I was at it I also upgraded the API 29 Android emulator CI tests to API 33 (Android 13, the latest version), which required changing the sdkmanager target from default to google_apis since there is no API 33 emulator without Google APIs.

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

@Isira-Seneviratne can you confirm this is ok?

Due diligence

@Stypox Stypox marked this pull request as draft April 20, 2023 09:55
@Stypox Stypox force-pushed the update-gradle branch 3 times, most recently from cf97acf to 0dbb8a7 Compare April 20, 2023 13:30
@sonarcloud
Copy link

sonarcloud bot commented Apr 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@Stypox Stypox marked this pull request as ready for review April 20, 2023 13:57
@Stypox Stypox changed the title Upgrade Gradle from 7.5.1 to 8.0.0 and AGP from 7.4.0 to 8.0.0 Upgrade Gradle and AGP from 7.x to 8.x and use Java 17 Apr 20, 2023
Copy link
Member

@Isira-Seneviratne Isira-Seneviratne left a comment

Choose a reason for hiding this comment

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

I did a debug build, and I didn't encounter any issues with the build. This looks good to me.

@Isira-Seneviratne Isira-Seneviratne merged commit f74d794 into TeamNewPipe:dev Apr 20, 2023
TobiGr added a commit to TeamNewPipe/NewPipe-nightly that referenced this pull request Apr 23, 2023
Fixes build problems introduced with the bump of the Java version used in NewPipe (TeamNewPipe/NewPipe#10035).
Closes #4
This was referenced Jul 31, 2023
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.

2 participants