Settings.gradle 包含基于构建变体的项目

问题描述 投票:0回答:1

我有一个 flutter 模块并将其集成到我的本机模块中。您可以在下面看到集成代码。在我的本机应用程序中,我有四种风格“dev”、“debug”、“uat”、“release”。现在我想仅为“dev”和“debug”添加flutter模块,我该如何实现这一点?虽然我尝试从设置 gradle 捕获构建变体,但实现不起作用。

设置.gradle:

plugins {
 id "com.gradle.enterprise" version "3.8.1"
}

gradleEnterprise {
 buildScan {
    termsOfServiceUrl = "https://gradle.com/terms-of-service"
    termsOfServiceAgree = "yes"
 }
}

include ':debug'
include ':common-views'
include ':loggedout'
include ':network'
include ':view'
include ':security'
include ':data'
include ':archandroid'
include ':app'

//Below are the code for adding flutter module
setBinding(new Binding([gradle: this]))
evaluate(new File(
    settingsDir.parentFile,
    'Android/flutter_app_module/.android/include_flutter.groovy'
))
include ':flutter_app_module'
project(':flutter_app_module').projectDir = new File('..Android/flutter_app_module')

构建.gradle:

implementation project(':flutter')
android gradle android-gradle-plugin build.gradle flutter-module
1个回答
0
投票

每个 Android 构建变体都定义了自己的

implementation
配置以添加依赖项 (docs)

因此,您只需通过以下操作即可添加到

dev
debug
变体

dependencies {
    devImplementation project(':flutter')
    debugImplementation project(':flutter')
}
© www.soinside.com 2019 - 2024. All rights reserved.