Flutter - Android rookie tutorial package

2183931-25bb89a229d980af.jpg
icon.jpg

Ready to work

1 App signature creation keystore

If you already have your keystore adjusted to the next step

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

2 Create key.properties

Works within the androidfolder to create a new key.propertiesfile for the key database references:

storePassword=store的密码
keyPassword=key的密码
keyAlias=key
storeFile=#本地key.jks文件的绝对路径,例:/Users/xxxx/key.jks#

Map


2183931-e2079d285fbd7d01.png
key.properties.png

3 configuration signature in gradle

路径/android/app/build.gradle

  1. Original code
android {

change:

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

android {
  1. Original code
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.debug
    }
}

change to:

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

Packaging execute the command:

flutter build apk

If the package when Error:Execution failed for task ':app:lintVitalRelease'.the lintOptionscontent changes following code:

lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

Packaged release apk is located/build/app/outputs/apk/app-release.apk。

Real machine installation

USB connection with your Android device to your computer
cd.
Runflutter install

Reference: " released on Android APP "

Reproduced in: https: //www.jianshu.com/p/d71b8c181900

Guess you like

Origin blog.csdn.net/weixin_33704591/article/details/91265934