Android Studio 任务“:app:signReleaseBundle”执行失败

wgxvkvu9  于 2023-05-07  发布在  Android
关注(0)|答案(5)|浏览(396)

我有这个错误的时刻,使flutter build appbundle
这就是错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Failed to read key sd from store "C:\flutter_project\cursin2\cursin-main\android\app\upload-keystore.jks": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available

* 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

BUILD FAILED in 6s
Running Gradle task 'bundleRelease'...                              9,1s
Gradle task bundleRelease failed with exit code 1
PS C:\flutter_project\cursin2\cursin-main>

我已经尝试了所有的方法来修复它,但错误仍然出现。
我的key.properties:

storePassword=ul109000
keyPassword=ul109000
keyAlias=sd
storeFile=C:/flutter_project/cursin2/cursin-main/android/app/upload-keystore.jks
8ljdwjyq

8ljdwjyq1#

在android app/ build.gradle
内部android标签

def keystoreProperties = new Properties()
    def keystorePropertiesFile = rootProject.file('key.properties')
    if (keystorePropertiesFile.exists()) {
        keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    }

    signingConfigs {
        debug {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

storeFile路径将为./upload-keystore.jks
和/或

buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            minifyEnabled true
            shrinkResources true
            signingConfig signingConfigs.release
        }
    }
kmpatx3s

kmpatx3s2#

解决这个问题的唯一方法,对我有效的是:

  1. Flutter 清洗
    1.编辑我在关键属性中使用的路径。
    例如:“./upload-keystore.jks”到“C:/key/myapp/upload-keystore.jks”3. Flutter build appbundle
11dmarpk

11dmarpk3#

删除此内容:

debug {
    storeFile file(storeFile_)
    storePassword storePassword_
    keyAlias keyAlias_
    keyPassword keyPassword_
}
9fkzdhlc

9fkzdhlc4#

第一次

单位:android app/ build.gradle
替换此

buildTypes {
       release {
           signingConfig signingConfigs.release
       }
   }

用这个

buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            minifyEnabled true
            shrinkResources true
            signingConfig signingConfigs.release
        }
   }

第二次

删除生成路径中的upload-keystore.jks在我的示例中(Ubuntu OS)路径是/home/user/upload-keystore.jks

第三次

生成一个新的密钥,带有额外的属性

-storetype JKS

用于Linux

keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload -storetype JKS
rdlzhqv9

rdlzhqv95#

在我的情况下,key.properties文件丢失(您可以在android/build.gradle中找到)。如果你从github克隆了你的repo,然后尝试创建appbundle,那么这个问题可能会出现。
生成新的key.properties或使用以前的key.properties文件来创建appbundle。

相关问题