MO.*_*LAH 3 github dart flutter flutter-dependencies
它一直告诉我需要将您的应用程序迁移到 Android 嵌入 v2。按照https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects上的步骤操作
注意...它与遵循此步骤相同 https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects 但我让任何无法遵循这些步骤的人都变得更容易.. ...希望有帮助。
在尝试了多种方法处理该情况后,
我最终得到了一个足够好的解决方案
只需在项目中打开此文件并复制>>粘贴此代码行即可工作......确保删除此文件中的所有代码行并将其替换为新代码行。
1:MainActivity.java
包 co.appbrewery.flash_chat;
导入 io.flutter.embedding.android.FlutterActivity;
公共类 MainActivity 扩展 FlutterActivity {
}
2:样式.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
3:AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="co.appbrewery.flash_chat">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
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:label="flash_chat" android:icon="@mipmap/ic_launcher">
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data android:name="flutterEmbedding" android:value="2" />
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24644 次 |
| 最近记录: |