Closed dhs964057117 closed 2 months ago
你好,不好意思打扰了,可以请教个问题吗,目前使用agp:8.3.1,gradle版本8.4,完成了命名空间的更改,废弃gradle api的替换,最后报错: A problem was found with the configuration of task ':sample-app:duplicatePluginDebugApkTask' (type 'Copy').
Gradle detected a problem with the following location: 'E:\workspace\Shadow\projects\sample\source\sample-plugin\sample-app\build\outputs\apk\plugin\debug'.
Reason: Task ':sample-app:createPluginDebugApkListingFileRedirect' uses this output of task ':sample-app:duplicatePluginDebugApkTask' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
我能明白这个意思,但不知道如何修复,麻烦大佬指点
我在代码中搜不到ListingFileRedirect
,这恐怕是你自己写的吧。
我在代码中搜不到
ListingFileRedirect
,这恐怕是你自己写的吧。
我没有做任何改动,只是加了命名空间以及废弃api的替换,目前的情况是我将这里做改动后这个错误消失了 def createDuplicateApkTask(buildType) { // def apkDir = file("${getBuildDir()}/outputs/apk/plugin/$buildType") def apkDir = file("${getBuildFile().absolutePath}/outputs/apk/plugin/$buildType") return tasks.create("duplicatePlugin${buildType.capitalize()}ApkTask", Copy) { group = 'build' description = "复制一个sample-app-plugin-${buildType}.apk用于测试目的" from(apkDir) { include("sample-app-plugin-${buildType}.apk") rename { "sample-app-plugin-${buildType}2.apk" } } into(apkDir)
}.dependsOn(":sample-app:assemblePlugin${buildType.capitalize()}")
} 但是下面将apk改名为2.apk的操作貌似没有生效,因为提示找不到2.apk这个文件,我手动复制重命名后正常运行了
我在代码中搜不到
ListingFileRedirect
,这恐怕是你自己写的吧。
实际发现这里改动之后的路径是错误的,后续都没执行,手动复制的apk启动后会崩溃,改回原来正确的地址报错:
Exception is: org.gradle.internal.execution.WorkValidationException: Some problems were found with the configuration of task ':sample-app:packageDebugPlugin' (type 'Zip').
Reason: Task ':sample-app:packageDebugPlugin' uses this output of task ':sample-app:duplicatePluginDebugApkTask' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
For more information, please refer to https://docs.gradle.org/8.4/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
Reason: Task ':sample-app:packageDebugPlugin' uses this output of task ':sample-app:duplicatePluginDebugApkTask' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
那估计应该是sample的自定义复制apk的任务被新版AGP认为是不规范的关系了。
但是我们目前没有什么理由升级Shadow的AGP版本。我估计你也不应该有这样的需求,除非你在特别激进的开发Shadow。 如果你只是使用shadow,肯定是不用改Shadow的代码的。
Shadow自身升级到AGP 8.0+没有什么需求,工作量也不小,主要就是那些示例代码改起来很麻烦,也没什么收益。
在gradle8中transform 相关api已被废弃,请问有适配方案或者适配计划吗