B站視訊
www.bilibili.com/video/BV1G5… www.bilibili.com/video/BV1ik…
本節目標
- 編譯 build releae
- 程式瘦身
- 混淆程式
- 修改程式名稱
- 製作圖示
- 製作啟動畫面
正文
1. APP 圖示
規格說明
developer.android.com/google-play…
developer.apple.com/design/huma…
圖示尺寸
android 512x512
ios 1024x1024
線上工具
www.designevo.com/cn/logo-mak…
flutter_launcher_icons 外掛
pubspec.yaml
dev_dependencies:
# icons
flutter_launcher_icons: ^0.7.5
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icons/logo-1024.png"
複製程式碼
生成圖示
flutter pub run flutter_launcher_icons:main
複製程式碼
圖示目錄
android/app/src/main/res
ios/Runner/Assets.xcassets/AppIcon.appiconset
2. 啟動圖片
規格說明
developer.apple.com/design/huma…
developer.android.com/about/dashb…
圖片尺寸
iPhone XS Max 1242px × 2688px
android xxhdpi xhdpi
線上工具
3. Android 釋出
證照籤名說明
developer.android.com/studio/publ…
生成證照
# 進入目錄 android/app/
keytool -genkey -v -keystore ./key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
# 輸出檔案
android/app/key.jks
複製程式碼
Gradle 配置
-
android/gradle.properties
android.enableAapt2=false # 不檢測依賴資源 複製程式碼
-
android/key.properties
storePassword=123456 keyPassword=123456 keyAlias=key storeFile=./key.jks 複製程式碼
-
android/app/build.gradle
// 定義屬性讀取物件,讀取 android/key.properties def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } android { compileSdkVersion 28 ... // 簽名配置 signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] } } buildTypes { // 釋出配置 release { signingConfig signingConfigs.release } } } 複製程式碼
修改版本號
- pubspec.yaml
version: 1.0.0+1
複製程式碼
修改程式名稱
-
android/app/src/main/AndroidManifest.xml
<application android:name="io.flutter.app.FlutterApplication" android:label="貓哥新聞" android:icon="@mipmap/launcher_icon"> 複製程式碼
設定網路許可權
-
android/app/src/main/AndroidManifest.xml
</application> <uses-permission android:name="android.permission.INTERNET" /> </manifest> 複製程式碼
編譯打包
flutter build apk --split-per-abi
複製程式碼
輸出目錄
✓ Built build/app/outputs/apk/release/app-armeabi-v7a-release.apk (7.2MB).
✓ Built build/app/outputs/apk/release/app-arm64-v8a-release.apk (7.4MB).
✓ Built build/app/outputs/apk/release/app-x86_64-release.apk (7.6MB).
複製程式碼
混淆編譯
-
android/gradle.properties
extra-gen-snapshot-options=--obfuscate 複製程式碼
-
android/proguard-rules.pro
#Flutter Wrapper -dontwarn io.flutter.** -keep class io.flutter.app.** { *; } -keep class io.flutter.plugin.** { *; } -keep class io.flutter.util.** { *; } -keep class io.flutter.view.** { *; } -keep class io.flutter.** { *; } -keep class io.flutter.plugins.** { *; } 複製程式碼
-
android/app/build.gradle
buildTypes { release { signingConfig signingConfigs.release minifyEnabled true //資源壓縮設定 useProguard true //程式碼壓縮設定 //讀取程式碼壓縮配置檔案 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } 複製程式碼
-
編譯
flutter build apk --split-per-abi
複製程式碼
啟動頁
- 圖片
-
android/app/src/main/res/values/colors.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="cyan">#deecec</color> </resources> 複製程式碼
-
android/app/src/main/res/drawable/launch_background.xml
<?xml version="1.0" encoding="utf-8"?> <!-- Modify this file to customize your launch splash screen --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/cyan" /> <item> <bitmap android:gravity="center" android:src="@mipmap/launch_image" /> </item> </layer-list> 複製程式碼
4. IOS 釋出
啟動頁
修改程式名稱
資源
視訊
藍湖設計稿(加微信給授權 ducafecat)
lanhuapp.com/url/lYuz1 密碼: gSKl
藍湖現在收費了,所以檢視標記還請自己上傳 xd 設計稿 商業設計稿檔案不好直接分享, 可以加微信聯絡 ducafecat
YAPI 介面管理
程式碼
參考
developer.android.com/google-play…
developer.apple.com/design/huma…
developer.apple.com/design/huma…
developer.android.com/about/dashb…