在一次编译过程中发现有以下提示:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
大概意思就是当前的版本有些api会在gradle8.0中移除。详情可以使用命令行--warning-mode all
进行查看。
所以在终端执行以下命令:
gradle --warning-mode all
得到以下结果:
rockey211119@rockey211119s-MacBook-Pro RockeyClean % gradle --warning-mode all
Starting a Gradle Daemon (subsequent builds will be faster)
The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.3/userguide/upgrading_version_6.html#jcenter_deprecation
at settings_ced5934gp3ys17aor5yf3drv7$_run_closure1$_closure2.doCall(/Users/rockey211119/Documents/Android/AndroidWorkSpace/RockeyClean/settings.gradle:6)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
> Configure project :app
WARNING:The option setting 'android.enableR8.fullMode=true' is experimental.
The current default is 'false'.
> Task :help
Welcome to Gradle 7.3.
To run a build, run gradle <task> ...
To see a list of available tasks, run gradle tasks
To see more detail about a task, run gradle help --task <task>
To see a list of command-line options, run gradle --help
For more detail on using Gradle, see https://docs.gradle.org/7.3/userguide/command_line_interface.html
For troubleshooting, visit https://help.gradle.org
BUILD SUCCESSFUL in 6s
1 actionable task: 1 executed
根据提示知道RepositoryHandler.jcenter()
函数将在gradle8.0被移除。需要使用mavenCentral()
替换。
搜索全局jcenter()
。通常都在build.gradle文件中。进行替换。不过通常会出现问题,因为这是个依赖仓库,有些仓库还没有迁移到maven。所以可能会出问题。剩下的就根据具体问题进行具体解决