Flutter in App package process

 

Packed and ready: App icon, app name

(1) project root directory / android / app / src / main / res /

After entering you will see a lot mipmap- prefixed named folder, behind is the pixel density, we can see the resolution of the icon.

  • mdpi (in) ~ 160dpi
  • hdpi (high) ~ 240dip
  • xhdpi (ultra) ~ 320dip
  • xxhdpi (Super Ultra) ~ 480dip
  • xxxhdpi (Ultra Ultra) ~ 640dip

The pixel density of the corresponding picture into the corresponding folder, remember to use png format images, the name should be unified, to be consistent with the original name

(2) find AndroidManifest.xml file

This file is mainly used to configure the name of APP, icons and system privileges, the directory is located at:

Project root directory /android/app/src/main/AndroidManifest.xml

android:label="flutter_app"   //APP的名称
android:icon="@mipmap/ic_launcher"

Generated keystore

keytool -genkey -v -keystore D:/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key

 

With this key.jks file, you can go to the project directory androidfolder, create a file named key.properties and open paste the following code.

storePassword=<password from previous step>    //输入上一步创建KEY时输入的 密钥库 密码
keyPassword=<password from previous step>    //输入上一步创建KEY时输入的 密钥 密码
keyAlias=key
storeFile=<E:/key.jks>    //key.jks的存放路径

Amended as follows:

storePassword=123456
keyPassword=123456
keyAlias=key
storeFile=D:/key.jks

This work and do not share it, oh, this Key. Even if successful.

Configuration key registration

After the key generation is good, need to be configured in build.gradle file. This process is very simple, is to copy and paste something, you do not need to know the specific use of these files.

Item One:

/Android/app/build.gradle file into the project directory, in android{front of this line, add the following code:

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

The following code is replaced

buildTypes {
    release {
        signingConfig signingConfigs.debug
    }
}

Replacing code:

signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']
    }
}
buildTypes {
    release {
        signingConfig signingConfigs.release
    }
}

last step

执行命令:flutter build apk

Complete package!

Released nine original articles · won praise 13 · views 30000 +

Guess you like

Origin blog.csdn.net/qianlixiaomage/article/details/104094695