我在航站楼创建了一个flutter create chat_app人的Flutter 翼项目.但是,androidManifest.xml中缺少包属性.如何解决这个问题?

先谢谢你了.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:label="chat_app"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@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"
              />
            <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>

我试了flutter create --org com.chat_app chat_app次,但没有用.

推荐答案

您的AndroidManifest.xml缺少package属性,因为它已从flutter CLI工具模板中删除.它已被弃用.它被移除了in this PR.

在基于Gradle的构建系统中,从AGP 7.3开始,不直接在源 list 文件中设置包值.有关更多信息,请参见设置应用程序ID.

https://developer.android.com/guide/topics/manifest/manifest-element#package

你的android/app/build.gradle应该在android {}中有一个namespace语句,而不是像这样:

// ...

android {
  namespace "com.chat_app"

  // ...
}

Flutter相关问答推荐

关闭视频通话,相机仍在运行!(Flutter WebRTC)

在Riverpod ConsumerWidget中使用文本编辑控制器

Flutter 中的面向对象模式

为什么Riverpod生成器在这种情况下不生成AsyncNotiator?

摆动如何更改弹出菜单项高亮显示 colored颜色 半径

点击表情符号按钮后,Flutter 文本域文本编辑控制器将文本恢复为原始值

使用Future函数的容器中未显示图像,但在使用图像小工具时显示

查询满足AND条件的文档的FiRestore

Flutter Riverpod,将默认的BTC值改写为我的新状态

BoxConstraints强制使用无限宽度(列中的Listview)

Flutter 日期时间格式

如何在巡逻测试期间重新启动dart 侧应用程序状态?

Flutter http 请求获取 null

Dart/Flutter 泛型:类型 '(SearchFilterItemModel) => String' 不是类型 '(SearchFilterItemModel) => String' 的子类型

Flutter如何从深入嵌套的小部件中打开抽屉?

我对 Flutter Apk 有疑问

我在手机上找不到我的 Flutter 应用缓存数据

为什么轮播加载图片很慢?

Flutter 如何要求用户在应用程序中设置电话密码?

我想在数组中添加项目