当前位置:   article > 正文

Flutter打包的时候的错误解决(mac)-更新中_execution failed for task ':app:packageixccrelease

execution failed for task ':app:packageixccrelease'. > a failure occurred wh

创建证书

  • release版本
keytool -genkey -v -keystore <存放的路径>/sign.jks -keyalg RSA -keysize 2048 -validity 10000 -alias sign
  • 1
  • debug
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -validity 10000
  • 1

jks与keystore:
keystore 是Eclipse 打包生成的签名。
jks是Android studio 生成的签名。
都是用来打包的,并保证应用的唯一性,这就是他们的最大的区别!
备注:很多第三方市场,我们上传apk的时候,他们只支持keystore,需要我们把.jks签名转化为.keystore!

  • 获取SHA1值
///在终端输入
keytool -list -v -keystore  <debug/release 文件路径>
  • 1
  • 2

错误1;

* What went wrong:                                                      
Execution failed for task ':app:validateSigningRelease'.                
> Keystore file 'xxxxxxxxx/android/app/android/app/key/key.jks' not found for signing config 'release'.
                                                                        
* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                        
* Get more help at https://help.gradle.org  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

在这里插入图片描述

错误2:

* What went wrong:                                                      
Execution failed for task ':app:packageRelease'.                        
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > com.android.ide.common.signing.KeytoolException: Failed to read key sign from store 'xxxxxxxxx/android/app/android/app/key/key.jks' : Invalid keystore format
                                                                        
* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                        
* Get more help at https://help.gradle.org    
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

在这里插入图片描述

解决方法:

出现这样的问题,一般都是jks文件没有获取对,首先可以先检查build.gradle里面对配置是否写正确,可以参考一下我的写法。

///配置打包文件
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

   ///配置打包文件
        signingConfigs {
                release {
                    // keyAlias keystoreProperties['sign']
                    // keyPassword keystoreProperties['zxcvbnm']
                    // storeFile file(keystoreProperties['/Users/ggboy/work/practice/noob_program/android/app/key/key.jks'])
                    // storePassword keystoreProperties['zxcvbnm']
                   keyAlias 'sign'
                   keyPassword 'zxcvbnm'
                   storeFile file('你自己的签名路径/key.jks')
                   storePassword 'zxcvbnm'

                }
         debug {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile file(keystoreProperties['你自己的签名路径/key.jks'])
           storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {     
            signingConfig signingConfigs.release
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        } 
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

重点来了
上面的配置文件,signingConfigs一定要写在buildTypes之前。
如果你确认,你的签名文件build.gradle里面的配置完全正确的话,接下来这样做,

  • 你的签名不要放在项目文件夹里面,自己在其他盘新建文件夹存放签名,
  • 使用绝对地址。
  storeFile file(keystoreProperties['其他盘符的绝对路径/key.jks'])
  • 1

这样的话基本都可以正确打包。

错误三

* What went wrong:
Execution failed for task ':flutter_baidu_mapapi_base:stripReleaseDebugSymbols'.
> No version of NDK matched the requested version 20.0.5594570. Versions available locally: 22.1.7171670
  • 1
  • 2
  • 3

在这里插入图片描述
解决方案:

出现这个问题,就是Ndk版本不匹配,本地的版本是22的,但是项目需求是20的,降低版本就可以。
看我操作:

  1. 在as中打开
    在as中打开
  2. 选择自己所需要的版本,就可以。

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/820065
推荐阅读
相关标签
  

闽ICP备14008679号