Repository navigation
fix(android): 确保生成的 Kotlin 配置参与编译 - #777
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
当宿主 Flutter 项目启用 AGP 9 的 Built-in Kotlin:
android.builtInKotlin=true使用
fluwx_no_pay构建 Android APK 时,Kotlin 编译失败:FluwxConfigurations.kt是根据宿主项目pubspec.yaml自动生成的配置文件。原因
插件原本通过 Android
sourceSets.main.java.srcDirs注册生成目录:在 Kotlin Gradle Plugin 模式下,该目录会被 Kotlin 编译任务间接识别。
启用 AGP Built-in Kotlin 后,Kotlin 编译任务不会自动继承这部分 Android Java source set 配置,因此生成文件虽然已经创建,但没有参与 Kotlin 编译。
修改内容
generateFluwxHelperFile任务引用。KotlinCompile任务依赖到配置生成任务。build/generated/src/kotlin显式加入 Kotlin 编译源码目录。这样可以确保:
FluwxConfigurations.kt。fluwx和fluwx_no_pay正确编译。验证
已通过:
APK 构建成功,
FluwxConfigurations相关编译错误已消失。