From 1a1b346c05ff6ab8e4c3b55155d3f2f69205003c Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 6 Feb 2022 07:12:26 -0800 Subject: [PATCH] Fix #5377 --- buildSrc/src/main/java/Codegen.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/Codegen.kt b/buildSrc/src/main/java/Codegen.kt index 8c29685b6..3b1a41e6a 100644 --- a/buildSrc/src/main/java/Codegen.kt +++ b/buildSrc/src/main/java/Codegen.kt @@ -204,8 +204,12 @@ fun genStubManifest(srcDir: File, outDir: File): String { names.addAll(c3.subList(0, 10)) names.shuffle(RANDOM) - // Distinct by lower case to support case insensitive file systems - val pkgNames = names.distinctBy { it.toLowerCase(Locale.ROOT) } + val pkgNames = names.subList(0, 50) + // Distinct by lower case to support case insensitive file systems + .distinctBy { it.toLowerCase(Locale.ROOT) } + // Old Android does not support capitalized package names + // Check Android 7.0.0 PackageParser#buildClassName + .map { it.decapitalize(Locale.ROOT) } var idx = 0 fun isJavaKeyword(name: String) = when (name) {