1、第一步终端命令
cn88-a@zyMacBook-Pro-2 catl-android % gradle -v
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 18.0.2.1 (Oracle Corporation 18.0.2.1+1-1)
OS: Mac OS X 11.4 aarch64
2、第二步终端命令
cn22-a@ zyMacBook-Pro-2 catl-android % gradle clean -c settings.gradle
> Task :clean UP-TO-DATE
:clean spend 1ms
> Task :app:clean
:app:clean spend 973ms
> Task :arms:clean
:arms:clean spend 32ms
> Task :easyPhotos:clean
:easyPhotos:clean spend 35ms
> Task :lib:clean
:lib:clean spend 15ms
00:00.97 :app:clean
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.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1s
5 actionable tasks: 4 executed, 1 up-to-date
3、第三步终端命令
cn22-a@zyMacBook-Pro-2 catl-android % gradle assembleDebug -c settings.gradle
> Task :app:clean
:app:clean spend 1ms
> Task :app:preBuild
:app:preBuild spend 0ms
> Task :app:preDebugBuild
:app:preDebugBuild spend 0ms
> Task :arms:preBuild UP-TO-DATE
:arms:preBuild spend 0ms
> Task :arms:preDebugBuild UP-TO-DATE
:arms:preDebugBuild spend 0ms
> Task :lib:preBuild UP-TO-DATE
:lib:preBuild spend 0ms
> Task :lib:preDebugBuild UP-TO-DATE
:lib:preDebugBuild spend 0ms
> Task :lib:compileDebugAidl NO-SOURCE
:lib:compileDebugAidl spend 0ms
> Task :arms:compileDebugAidl NO-SOURCE
:arms:compileDebugAidl spend 0ms
> Task :easyPhotos:preBuild UP-TO-DATE
:easyPhotos:preBuild spend 0ms
> Task :easyPhotos:preDebugBuild UP-TO-DATE
:easyPhotos:preDebugBuild spend 0ms
> Task :easyPhotos:compileDebugAidl NO-SOURCE
:easyPhotos:compileDebugAidl spend 0ms
> Task :app:compileDebugAidl NO-SOURCE
:app:compileDebugAidl spend 0ms
> Task :arms:packageDebugRenderscript NO-SOURCE
:arms:packageDebugRenderscript spend 0ms
> Task :easyPhotos:packageDebugRenderscript NO-SOURCE
:easyPhotos:packageDebugRenderscript spend 0ms
> Task :lib:packageDebugRenderscript NO-SOURCE
:lib:packageDebugRenderscript spend 0ms
> Task :app:compileDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript spend 0ms
> Task :app:generateDebugBuildConfig FAILED
:app:generateDebugBuildConfig spend 4ms
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:generateDebugBuildConfig'.
> argument type mismatch
* 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
**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.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 575ms
2 actionable tasks: 2 executed
4、根据提示第四步终端命令
cn22-a@zyMacBook-Pro-2 catl-android % gradle --warning-mode all
> Configure project :app
**Internal API constructor DefaultDomainObjectSet(Class<T>) has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use ObjectFactory.domainObjectSet(Class<T>) instead. See https://docs.gradle.org/7.5.1/userguide/custom_gradle_types.html#domainobjectset for more details.
at build_a86hjuoyc3cbnhb1k4nowewdp.run(/Users/cn22-i570277-a/catl-android/app/build.gradle:1)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)**
> Task :help
Welcome to Gradle 7.5.1.
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.5.1/userguide/command_line_interface.html
For troubleshooting, visit https://help.gradle.org
:help spend 1ms
BUILD SUCCESSFUL in 393ms
1 actionable task: 1 executed
5、总结
第四步其实是一些警告信息,并不是真正的错误,错误还的从第三步查找,保证gradle的版本和插件版本匹配,java版本也要匹配
Plugin version插件版本 | required Gradle version |
---|---|
4.0.0+ | 6.1.1 |
4.1.0 | 6.6 |
step1
我选择的Gradle版本 7.5.1,gradle就用最新没毛病;
step2
Plugin version插件版本classpath 'com.android.tools.build:gradle:4.1.0'
step3
降低java版本配置好JAVA版本等环境变量,
file ->project Structure >Gradele Settings->选择合适的版本
step4
aspectjx等版本如果低了,就按照提示升级对应的版本
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'
最终搞定