Unverified Commit 9e0df259 authored by xster's avatar xster Committed by GitHub

Show a warning when a module uses a v1 only plugin (#44499)

parent 159a47da
......@@ -402,6 +402,16 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
for (Map<String, dynamic> plugin in androidPlugins) {
if (plugin['supportsEmbeddingV1'] && !plugin['supportsEmbeddingV2']) {
templateContext['needsShim'] = true;
if (project.isModule) {
printStatus(
'The plugin `${plugin['name']}` is built using an older version '
"of the Android plugin API which assumes that it's running in a "
'full-Flutter environment. It may have undefined behaviors when '
'Flutter is integrated into an existing app as a module.\n'
'The plugin can be updated to the v2 Android Plugin APIs by '
'following https://flutter.dev/go/android-plugin-migration.'
);
}
break;
}
}
......
......@@ -645,6 +645,11 @@ class AndroidProject {
}
AndroidEmbeddingVersion getEmbeddingVersion() {
if (isModule) {
// A module type's Android project is used in add-to-app scenarios and
// only supports the V2 embedding.
return AndroidEmbeddingVersion.v2;
}
if (appManifestFile == null || !appManifestFile.existsSync()) {
return AndroidEmbeddingVersion.v1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment