Skip to content

Migrate to Gradle 9.0.0#385

Closed
bocchi810 wants to merge 3 commits intomasterfrom
gradle-lint-new
Closed

Migrate to Gradle 9.0.0#385
bocchi810 wants to merge 3 commits intomasterfrom
gradle-lint-new

Conversation

@bocchi810
Copy link
Copy Markdown

This Pull Request Update Gradle version to 9.0.0, fixed the issue where some syntax was unavailable on 9.0.0
Also downgrade NDK version to 28.2, and fix gradle-lint issues

  D:\LSPosed\app\src\main\AndroidManifest.xml:61: Error: Class referenced in the manifest, androidx.startup.InitializationProvider, was not found in the project or the libraries [MissingClass]
              android:name="androidx.startup.InitializationProvider"
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@JingMatrix

This commit upgrades the Gradle version to 9.0.0.
Additionally, it refactors the build scripts in `magisk-loader` and `apache` modules to use the `tasks.register` API for task creation.
The `androidResources` build feature is now explicitly disabled using the new syntax in `dex2oat` and `core` modules.
To fix the gradle-lint issues, the `androidx.startup` dependency is added to the `app` module.
@JingMatrix
Copy link
Copy Markdown
Owner

Since the build failed, it is better to revert the NDK version. Alternatively, you may update to latest NDK rc with careful tests.

@JingMatrix
Copy link
Copy Markdown
Owner

Moreover, run task gradle :app:lintDebug to fix possible lint issues, as indicated in #362.

@JingMatrix
Copy link
Copy Markdown
Owner

It remains to update the gradle wrapper.

@JingMatrix
Copy link
Copy Markdown
Owner

Here is the result of :app:lintDebug. I wonder if there is a chance to solve the CancelableFontCallback problem.

* What went wrong:
Execution failed for task ':app:lintDebug'.
> Lint found errors in the project; aborting build.
  
  Fix the issues identified by lint, or create a baseline to see only new errors.
  To create a baseline, run `gradlew updateLintBaseline` after adding the following to the module's build.gradle file:
android {
    lint {
        baseline = file("lint-baseline.xml")
    }
}
  For more details, see https://developer.android.com/studio/write/lint#snapshot
  
  Lint found 108 errors, 57 warnings. First failure:
  
  /home/jing/Documents/Project/LSPatch/core/app/src/main/java/com/google/android/material/internal/SubtitleCollapsingTextHelper.java:80: Error: CancelableFontCallback can only be accessed from within the same library group (referenced groupId=com.google.android.material from groupId=LSPosed) [RestrictedApi]
      private CancelableFontCallback expandedTitleFontCallback, expandedSubtitleFontCallback;
              ~~~~~~~~~~~~~~~~~~~~~~
  
  The full lint text report is located at:
    /home/jing/Documents/Project/LSPatch/core/app/build/intermediates/lint_intermediate_text_report/debug/lintReportDebug/lint-results-debug.txt

@bocchi810
Copy link
Copy Markdown
Author

Here is the result of :app:lintDebug. I wonder if there is a chance to solve the CancelableFontCallback problem.

* What went wrong:
Execution failed for task ':app:lintDebug'.
> Lint found errors in the project; aborting build.
  
  Fix the issues identified by lint, or create a baseline to see only new errors.
  To create a baseline, run `gradlew updateLintBaseline` after adding the following to the module's build.gradle file:
android {
    lint {
        baseline = file("lint-baseline.xml")
    }
}
  For more details, see https://developer.android.com/studio/write/lint#snapshot
  
  Lint found 108 errors, 57 warnings. First failure:
  
  /home/jing/Documents/Project/LSPatch/core/app/src/main/java/com/google/android/material/internal/SubtitleCollapsingTextHelper.java:80: Error: CancelableFontCallback can only be accessed from within the same library group (referenced groupId=com.google.android.material from groupId=LSPosed) [RestrictedApi]
      private CancelableFontCallback expandedTitleFontCallback, expandedSubtitleFontCallback;
              ~~~~~~~~~~~~~~~~~~~~~~
  
  The full lint text report is located at:
    /home/jing/Documents/Project/LSPatch/core/app/build/intermediates/lint_intermediate_text_report/debug/lintReportDebug/lint-results-debug.txt

Currently all we can do is suppress this warning

@bocchi810
Copy link
Copy Markdown
Author

I tried the lowest version 8.13, and it was the same. If it was any lower, I would have to lower the AGP. After lowering the AGP, some problems occurred.

 ./gradlew :app:lint                                                                                                                                                                                                  
                                                                                                                                                                                                                                    
Welcome to Gradle 8.13!

Here are the highlights of this release:
 - Daemon JVM auto-provisioning
 - Enhancements for Scala plugin and JUnit testing
 - Improvements for build authors and plugin developers

For more details see https://docs.gradle.org/8.13/release-notes.html

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Type-safe project accessors is an incubating feature.

> Configure project :app
Apksign fallbacks to use debug singature as null does not exist

> Task :services:manager-service:compileDebugJavaWithJavac
注: D:\LSPosed\services\manager-service\build\generated\aidl_source_output_dir\debug\out\org\lsposed\lspd\ILSPManagerService.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。

> Task :app:compileDebugJavaWithJavac
注: [1] Wrote GeneratedAppGlideModule with: []
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。                                                                                                                                                                              
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。

> Task :app:lintReportDebug
Wrote HTML report to file:///D:/LSPosed/app/build/reports/lint-results-debug.html                                                                                                                                                   
Lint found 108 errors and 57 warnings. First failure:                                                                                                                                                                               
D:\LSPosed\app\src\main\java\com\google\android\material\internal\SubtitleCollapsingTextHelper.java:80: Error: CancelableFontCallback can only be accessed from within the same library group (referenced groupId=com.google.android.material from groupId=LSPosed) [RestrictedApi]
    private CancelableFontCallback expandedTitleFontCallback, expandedSubtitleFontCallback;
            ~~~~~~~~~~~~~~~~~~~~~~


> Task :app:lintDebug FAILED                                                                                                                                                                                                        
Lint found 108 errors, 57 warnings. First failure:

D:\LSPosed\app\src\main\java\com\google\android\material\internal\SubtitleCollapsingTextHelper.java:80: Error: CancelableFontCallback can only be accessed from within the same library group (referenced groupId=com.google.android.material from groupId=LSPosed) [RestrictedApi]
    private CancelableFontCallback expandedTitleFontCallback, expandedSubtitleFontCallback;
            ~~~~~~~~~~~~~~~~~~~~~~

The full lint text report is located at:
  D:\LSPosed\app\build\intermediates\lint_intermediate_text_report\debug\lintReportDebug\lint-results-debug.txt

[Incubating] Problems report is available at: file:///D:/LSPosed/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lintDebug'.
> Lint found errors in the project; aborting build.

  Fix the issues identified by lint, or create a baseline to see only new errors.
  To create a baseline, run `gradlew updateLintBaseline` after adding the following to the module's build.gradle file:
  android {
      lint {
          baseline = file("lint-baseline.xml")
      }
  }
  For more details, see https://developer.android.com/studio/write/lint#snapshot

  Lint found 108 errors, 57 warnings. First failure:

  D:\LSPosed\app\src\main\java\com\google\android\material\internal\SubtitleCollapsingTextHelper.java:80: Error: CancelableFontCallback can only be accessed from within the same library group (referenced groupId=com.google.android.material from groupId=LSPosed) [RestrictedApi]
      private CancelableFontCallback expandedTitleFontCallback, expandedSubtitleFontCallback;
              ~~~~~~~~~~~~~~~~~~~~~~

  The full lint text report is located at:
    D:\LSPosed\app\build\intermediates\lint_intermediate_text_report\debug\lintReportDebug\lint-results-debug.txt

* 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.

BUILD FAILED in 1m 20s
71 actionable tasks: 71 executed

@JingMatrix
Copy link
Copy Markdown
Owner

I will merge it when my Arch Linux includes gradle 9.0 into its update source list.

androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.4.0" }
androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version = "1.2.0-beta01" }
#noinspection GradleDependency
androidx-startup = { module = "androidx.startup:startup-runtime", version = "1.1.1" }
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why do we need this?


buildFeatures {
androidResources = false
android.androidResources.enable = false
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@JingMatrix JingMatrix closed this Nov 8, 2025
JingMatrix added a commit that referenced this pull request Nov 8, 2025
When upgrading to gradle 9 +, we remove several unused tasks for development to simplify the process.

Close #385, #441, #445, #448, #462 as merged.
JingMatrix added a commit that referenced this pull request Nov 8, 2025
When upgrading to gradle 9 +, we remove several unused tasks for development to simplify the process.

Close #385, #441, #445, #448, #462 as merged.
JingMatrix added a commit that referenced this pull request Nov 8, 2025
When upgrading to gradle 9 +, we remove several unused tasks for development to simplify the process.

Close #385, #441, #445, #448, #462 as merged.
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