最近在公司构建平台上新增了一个android构建项目。但是在参照之前项目配置好构建参数后,执行构建报错了,在本地apk构建都是OK的啊,怎么回事?赶紧看了下构建日志信息。重要的报错信息如下:
09-15 10:41:49 FAILURE: Build failed with an exception.
09-15 10:41:49
09-15 10:41:49 * What went wrong:
09-15 10:41:49 Could not determine the dependencies of task ':SpeechClient:lintVitalCd569Release'.
09-15 10:41:49 > Could not resolve all artifacts for configuration ':SpeechClient:cd569DebugCompileClasspath'.
09-15 10:41:49 > Could not resolve project :MMEmotionCore.
09-15 10:41:49 Required by:
09-15 10:41:49 project :SpeechClient
09-15 10:41:49 project :SpeechClient > project :VoiceCoreService
09-15 10:41:49 > Unable to find a matching configuration of project :MMEmotionCore:
09-15 10:41:49 - None of the consumable configurations have attributes.
09-15 10:41:49
09-15 10:41:49 * Try:
09-15 10:41:49 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.
09-15 10:41:49
09-15 10:41:49 * Get more help at https://help.gradle.org
09-15 10:41:49
09-15 10:41:49 BUILD FAILED in 18s
为什么报MMEmotionCore 这个module找不到匹配的配置?检查了下settings.gradle中include 一切都是正常的?会不会是gradle plugin版本或者gradle版本不匹配导致?
分别更换了gradle plugin和gradle版本依然报这个错? 难道构建服务器上的gradle有问题?于是上传了了本地的gradle文件夹和gradlew和gradlew.bat,将构建命令改成了cd到当前workspace下执行gradlew构建命令,试图保持和本地构建使用一样的构建环境,但是结果依然报同样的错。
于是各种谷歌,各种百度,依然是看不到十分有用的信息,于是静下心来重新审视这个报错信息。既然是报这个Module解析有问题,会不会是module的名称有问题,换一个名称试试?
大胆的试了下把module名称从MMEmotionCore换成了emotionCore,其他gradle plugin和gradle版本换回了初始版本,一跑居然构建成功了。
坑爹的gradle,难道是module名称不能以重复的字母开头?无语了。希望遇到这样错误的小伙伴在尝试了各种网上的方法后如果还不能解决不妨改module名称一试。