:::

8. 打包

加上首頁啟動 icon

  • 準備一張 1024X1024 的圖檔
  • 到app icon網站自動產生需要的icon檔 https://appicon.co/
  • 把檔案放到以下的資料夾 <app dir>/android/app/src/main/res/

App 金鑰

  • Mac
    keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
  • Windows
    keytool -genkey -v -keystore ./key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
  • 在 android 資料夾中制作一個 <app dir>\android\key.properties 檔案
    storePassword=密碼
    keyPassword=密碼
    keyAlias=key
    storeFile=../../key.jks
  •  編輯 <app dir>\android\app\build.gradle
    略
    
    def keystoreProperties = new Properties()
    def keystorePropertiesFile = rootProject.file('key.properties')
    if (keystorePropertiesFile.exists()) {
        keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    }
    android {
        略
    
        defaultConfig {
            略
        }
    
        signingConfigs {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
                storePassword keystoreProperties['storePassword']
            }
        }
    
        buildTypes {
            release {
                // TODO: Add your own signing config for the release build.
                // Signing with the debug keys for now, so `flutter run --release` works.
                signingConfig signingConfigs.release
            }
        }
    }

     

  •  到<app dir>/android/app/src/main/AndroidManifest.xml修改app 顯示名稱

編譯 APK 檔

flutter build apk --split-per-abi --target-platform android-arm,android-arm64,android-x64

 


:::

書籍目錄

展開 | 闔起

快速登入


https%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1904%26tbsn%3D42

計數器

今天: 3826382638263826
昨天: 2489248924892489
總計: 8025808802580880258088025808802580880258088025808