Add a profile build type to the Android app template (with plugin support) (#22884)
This is required in order to support "flutter run --profile"
diff --git a/packages/flutter_tools/gradle/flutter.gradle b/packages/flutter_tools/gradle/flutter.gradle
index 7d58d8e..a2799c0 100644
--- a/packages/flutter_tools/gradle/flutter.gradle
+++ b/packages/flutter_tools/gradle/flutter.gradle
@@ -191,6 +191,13 @@
compile pluginProject
}
}
+ pluginProject.afterEvaluate {
+ pluginProject.android.buildTypes {
+ profile {
+ initWith debug
+ }
+ }
+ }
pluginProject.afterEvaluate this.&addFlutterJarCompileOnlyDependency
} else {
project.logger.error("Plugin project :$name not found. Please update settings.gradle.")
@@ -212,9 +219,11 @@
} else {
if (project.getConfigurations().findByName("debugCompileOnly")) {
debugCompileOnly project.files(debugFlutterJar)
+ profileCompileOnly project.files(profileFlutterJar)
releaseCompileOnly project.files(releaseFlutterJar)
} else {
debugProvided project.files(debugFlutterJar)
+ profileProvided project.files(profileFlutterJar)
releaseProvided project.files(releaseFlutterJar)
}
}
diff --git a/packages/flutter_tools/templates/application/android/host_app_common/app.tmpl/build.gradle.tmpl b/packages/flutter_tools/templates/application/android/host_app_common/app.tmpl/build.gradle.tmpl
index 3eb860c..4346c04 100644
--- a/packages/flutter_tools/templates/application/android/host_app_common/app.tmpl/build.gradle.tmpl
+++ b/packages/flutter_tools/templates/application/android/host_app_common/app.tmpl/build.gradle.tmpl
@@ -14,6 +14,9 @@
}
buildTypes {
+ profile {
+ initWith debug
+ }
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.