简体   繁体   English

Flutter - AndroidManifest.xml 在 Flutter 升级后损坏

[英]Flutter - AndroidManifest.xml corrupted after Flutter Upgrade

I've just upgraded to Flutter 2 and upgraded an application along with it.我刚刚升级到 Flutter 2 并随之升级了一个应用程序。 I followed all the steps to upgrade the application, but now I can't seem to run the app because my AndroidManifest.xml file seems corrupted.我按照所有步骤升级应用程序,但现在我似乎无法运行该应用程序,因为我的 AndroidManifest.xml 文件似乎已损坏。

Here is the xml file (I've also added comments where the errors are appearing).这是 xml 文件(我还在出现错误的地方添加了注释)。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.finances_management">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <application
        android:name="io.flutter.app.FlutterApplication" <-- Unresolved class 'FlutterApplication' 
        android:label="finances_management"
        android:icon="@mipmap/ic_launcher"> <-- Cannot resolve symbol '@mipmap/ic_launcher'
        <activity
            android:name=".MainActivity" <-- Unresolved class 'MainActivity' 
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme" <-- Cannot resolve symbol '@style/LaunchTheme'
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme" <-- Cannot resolve symbol '@style/NormalTheme' 
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background" <-- Cannot resolve symbol '@drawable/launch_background' 
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <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>

I've seen elsewhere that people are just completely rebuilding their projects (as in completely generating a new project, stripping business logic from their Flutter 1.x app and copying it across to a Flutter 2.x app).我在其他地方看到人们只是在完全重建他们的项目(就像完全生成一个新项目,从他们的 Flutter 1.x 应用程序中剥离业务逻辑并将其复制到 Flutter 2.x 应用程序一样)。 Does anyone know what's happened to my XML file?有谁知道我的 XML 文件发生了什么?

The best solution is to downgrade the Flutter.最好的解决方案是降级 Flutter。 after that update AndroidManifest file之后更新 AndroidManifest 文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM