Flutter 打包发版常见问题

一、安卓方面

  1.  打包后apk打开时闪屏关闭
    1. android {
              buildTypes {
                  release {
                      // Enables code shrinking, obfuscation, and optimization for only
                      // your project's release build type.
                      minifyEnabled false
      
                      // Enables resource shrinking, which is performed by the
                      // Android Gradle plugin.
                      shrinkResources false
                  }
              }
              ...
          }
      
  2. 配置签名文件

         key.properties   放在项目的android目录下面。demo.jks放在项目的android/app/key的目录下面,key目录自己手动创建。

storePassword=android1223
keyPassword=1234
keyAlias=demo
storeFile=key/demo.jks

         项目的android下的app目录里的build.gradle增加以下配置            

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

 signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            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
            //关闭混淆
            minifyEnabled false //删除无用代码
            shrinkResources false //删除无用资源
        }
    }

二、IOS方面

  1. app的icon的原因上传时报错。

          原因:1024*1024的icon 不能带有透明度。其它的icon可以做成圆角

     2. 在app store connect中填写联系信息中联系方式的电话号码时,输入11位手机号码格式错误

          原因:格式确实有问题,正常格式为:+86-xxxxxxxxxxx  如:+86-010-33339999

     3. 版本号使用统一的配置文件里的方式

         方法:需要在项目的ios目录下,使用 flutter build ios --build-name=1.0.2  打包或者再使用xcode打包,版本号就是配置文件里的。

猜你喜欢

转载自blog.csdn.net/saperliu/article/details/131584831