You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio Flutter项目安卓无启动图标及Manifest标签报错求助

Android启动图标不生成及AndroidManifest.xml标签下划线问题解决

问题概况

  • 卸载旧版Android Studio和SDK后,安装最新版Android Studio Flamingo及对应SDK
  • Flutter新模板项目可在iOS/安卓正常运行,但iOS能生成启动图标,安卓真机与模拟器均无法显示启动图标
  • AndroidManifest.xml中多个标签出现下划线提示
  • flutter doctor检测无异常

flutter doctor输出

flutter doctor -v                
[✓] Flutter (Channel stable, 3.7.7, on macOS 12.6.3 21G419 darwin-x64, locale en-US)
    • Flutter version 3.7.7 on channel stable at /Users/lk/programs/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2ad6cd72c0 (5 weeks ago), 2023-03-08 09:41:59 -0800
    • Engine revision 1837b5be5f
    • Dart version 2.19.4
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/lk/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.76.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (3 available)
    • Pixel 2 XL (mobile) • 806KPDT1944522 • android-arm64  • Android 11 (API 30)
    • macOS (desktop)     • macos          • darwin-x64     • macOS 12.6.3 21G419 darwin-x64
    • Chrome (web)        • chrome         • web-javascript • Google Chrome 112.0.5615.49

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

相关截图

AndroidManifest.xml文件中的下划线标签
启动图标目录结构


解决方案

一、安卓启动图标不生成问题

  1. 清除缓存并重建项目
    运行以下命令:
    flutter clean
    flutter pub get
    flutter run
    
  2. 验证Manifest图标配置
    打开android/app/src/main/AndroidManifest.xml,确认<application>标签内的图标路径正确:
    <application
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        ...>
    
  3. 手动生成图标
    若自动生成失败,使用flutter_launcher_icons插件:
    • 在pubspec.yaml添加依赖:
      dev_dependencies:
        flutter_launcher_icons: "^0.13.1"
      
    • 添加图标配置:
      flutter_launcher_icons:
        android: "launcher_icon"
        ios: true
        image_path: "assets/icon/icon.png"
      
    • 运行生成命令:
      flutter pub run flutter_launcher_icons:main
      

二、AndroidManifest.xml标签下划线问题

  1. 匹配SDK版本
    打开android/app/build.gradle,确认以下版本与SDK 33匹配:
    android {
        compileSdkVersion 33
        defaultConfig {
            targetSdkVersion 33
            ...
        }
    }
    
  2. 同步Gradle项目
    点击Android Studio右上角的「Sync Project with Gradle Files」按钮,完成同步。
  3. 清除IDE缓存
    路径:File > Invalidate Caches...,选择「Invalidate and Restart」重启IDE。
  4. 检查标签语法
    确认Manifest文件中标签无拼写错误、未闭合或多余属性问题。

内容的提问来源于stack exchange,提问作者Yogi Wannabe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 17:54:54