# Flutter - 改變APP名稱及Icon ## 更改名稱 ### Android ```xml <application android:label="與原生" android:name="${applicationName}" ``` ![](https://i.imgur.com/PwCadzg.png) ### IOS Info.plist ```xml <key>CFBundleDisplayName</key> <string>與原生</string> <key>CFBundleName</key> <string>與原生</string> ``` ## 更改Icon 1. 利用[線上工具](https://icon.kitchen/i/H4sIAAAAAAAAA6tWKkvMKU0tVrKqVkpJLMoOyUjNTVWySkvMKU6t1VHKzU8pzQHJRisl5qUU5WemKOkoZeYXA8ny1CSl2FoApT8%2BHkAAAAA%3D)生成APP圖片,並將圖檔下載 2. 將圖片放入資料夾`assets/icons/app.png` ![](https://i.imgur.com/CvXJMin.png) 3. 安裝flutter套件 ``` flutter pub add flutter_launcher_icons --dev ``` 4. 調整設定檔`pubspec.yaml` ``` flutter_launcher_icons: android: "launcher_icon" ios: true remove_alpha_ios: true image_path_android: "assets/images/app_logo.png" image_path_ios: "assets/images/app_logo.png" ``` 5. 執行指令套用icon ``` flutter pub run flutter_launcher_icons:main ``` ## 抱錯 ### Cannot not find minSdk from android/app/build.gradle ![](https://i.imgur.com/rkcbXKS.png) 調整minSdkVersion即可,[參考資料](https://github.com/fluttercommunity/flutter_launcher_icons/issues/371) ![](https://i.imgur.com/2ZvtB3u.png) ### Images can't contain alpha channels or transparencies ios 手機不可使用含有透明背景的圖示 #### 解決方法 使用 Mac 開啟圖片 > 檔案 > 屬性,把 alpha 的勾勾移除,點擊儲存即可 ![](https://i.imgur.com/an2R5qx.png) ###### tags: `flutter`