Reland "Exit on deprecated v1 embedding when trying to run or build (#92901)" (#93386)

This commit is contained in:
Gary Qian
2021-11-11 14:49:35 -08:00
committed by GitHub
parent 9659db7be8
commit eabb7cbc34
31 changed files with 278 additions and 64 deletions

View File

@@ -16,7 +16,7 @@ found in the LICENSE file. -->
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application android:name="io.flutter.app.FlutterApplication" android:label="Platform Interaction" android:icon="@mipmap/ic_launcher">
<application android:name="${applicationName}" android:label="Platform Interaction" android:icon="@mipmap/ic_launcher">
<activity android:name="com.yourcompany.platforminteraction.MainActivity"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Black.NoTitleBar"
@@ -28,5 +28,10 @@ found in the LICENSE file. -->
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>

View File

@@ -6,16 +6,10 @@ package com.yourcompany.platforminteraction;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.plugin.common.*;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
public void finish() {
BasicMessageChannel channel =
new BasicMessageChannel<>(getFlutterView(), "navigation-test", StringCodec.INSTANCE);