Move the plugin registrant to io.flutter.plugins and add the @Keep annotation (#44011)
This commit is contained in:
@@ -311,12 +311,14 @@ public final class GeneratedPluginRegistrant {
|
||||
}
|
||||
''';
|
||||
|
||||
const String _androidPluginRegistryTemplateNewEmbedding = '''package dev.flutter.plugins;
|
||||
const String _androidPluginRegistryTemplateNewEmbedding = '''package io.flutter.plugins;
|
||||
|
||||
{{#androidX}}
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.NonNull;
|
||||
{{/androidX}}
|
||||
{{^androidX}}
|
||||
import android.support.annotation.Keep;
|
||||
import android.support.annotation.NonNull;
|
||||
{{/androidX}}
|
||||
import io.flutter.embedding.engine.FlutterEngine;
|
||||
@@ -329,6 +331,7 @@ import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;
|
||||
* This file is generated by the Flutter tool based on the
|
||||
* plugins that support the Android platform.
|
||||
*/
|
||||
@Keep
|
||||
public final class GeneratedPluginRegistrant {
|
||||
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
|
||||
{{#needsShim}}
|
||||
@@ -399,10 +402,14 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
|
||||
'main',
|
||||
'java',
|
||||
);
|
||||
|
||||
String registryPath;
|
||||
final String registryPath = fs.path.join(
|
||||
javaSourcePath,
|
||||
'io',
|
||||
'flutter',
|
||||
'plugins',
|
||||
'GeneratedPluginRegistrant.java',
|
||||
);
|
||||
String templateContent;
|
||||
|
||||
final String appEmbeddingVersion = _getAndroidEmbeddingVersion(project);
|
||||
switch (appEmbeddingVersion) {
|
||||
case '2':
|
||||
@@ -415,23 +422,9 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
|
||||
break;
|
||||
}
|
||||
}
|
||||
registryPath = fs.path.join(
|
||||
javaSourcePath,
|
||||
'dev',
|
||||
'flutter',
|
||||
'plugins',
|
||||
'GeneratedPluginRegistrant.java',
|
||||
);
|
||||
templateContent = _androidPluginRegistryTemplateNewEmbedding;
|
||||
break;
|
||||
case '1':
|
||||
registryPath = fs.path.join(
|
||||
javaSourcePath,
|
||||
'io',
|
||||
'flutter',
|
||||
'plugins',
|
||||
'GeneratedPluginRegistrant.java',
|
||||
);
|
||||
templateContent = _androidPluginRegistryTemplateOldEmbedding;
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user