From 62badb528e06770f236f12c93d8c2232ebbbdfb9 Mon Sep 17 00:00:00 2001 From: xjy2061 Date: Thu, 24 Jun 2021 19:57:01 +0800 Subject: [PATCH] Fix failed to write manifest in AGP 4.1. --- .../tencent/tinker/build/gradle/Compatibilities.groovy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tinker-build/tinker-patch-gradle-plugin/src/main/groovy/com/tencent/tinker/build/gradle/Compatibilities.groovy b/tinker-build/tinker-patch-gradle-plugin/src/main/groovy/com/tencent/tinker/build/gradle/Compatibilities.groovy index 6328313b3..b8ebc8f9c 100644 --- a/tinker-build/tinker-patch-gradle-plugin/src/main/groovy/com/tencent/tinker/build/gradle/Compatibilities.groovy +++ b/tinker-build/tinker-patch-gradle-plugin/src/main/groovy/com/tencent/tinker/build/gradle/Compatibilities.groovy @@ -27,6 +27,11 @@ class Compatibilities { } static def getOutputManifestPath(project, manifestTask, variantOutput) { + try { + return new File(manifestTask.packageManifests.get().asFile, "${variantOutput.dirName}/AndroidManifest.xml") + } catch (Throwable ignored) { + // Ignored. + } try { return new File(manifestTask.multiApkManifestOutputDirectory.get().asFile, "${variantOutput.dirName}/AndroidManifest.xml") } catch (Throwable ignored) { @@ -60,7 +65,10 @@ class Compatibilities { } static def getProcessManifestTask(project, variant) { - return project.tasks.findByName("process${variant.name.capitalize()}Manifest") + def tasks = project.tasks + def task = tasks.findByName("process${variant.name.capitalize()}ManifestForPackage") + if (task != null) return task + return tasks.findByName("process${variant.name.capitalize()}Manifest") } static def getMergeResourcesTask(project, variant) {