如何使用Gitlab CI / CD生成签名发布的APK?

时间:2019-06-10 04:59:28

标签: android gitlab

我正在试验GitLab的CI / CD,并正在研究如何生成签名发布的APK。

我已经读过这篇文章here

它提出以下建议:

- ./gradlew assembleRelease
    -Pandroid.injected.signing.store.file=$(pwd)/my.keystore
    -Pandroid.injected.signing.store.password=$KEYSTORE_PASSWORD
    -Pandroid.injected.signing.key.alias=$KEY_ALIAS
    -Pandroid.injected.signing.key.password=$KEY_PASSWORD

并将变量存储在Gitlab CI / CD变量中。

但是每次我运行管道时,总会得到以下结果:

* What went wrong:
Execution failed for task ':app:packageRelease'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: 
com.android.ide.common.signing.KeytoolException: Failed to read key key0 from store "/tmp/Lp7GrQLJ/0/XXXXX/sample-android-project/keystore": Keystore was tampered with, or password was incorrect

有人可以在这里引导我吗?我可能做错了什么?

1 个答案:

答案 0 :(得分:1)

愿对您有帮助。

def clean_fieldname(self):  
    field_content = self.cleaned_data['field_name']  
    #validate the field here and raise Validation Error if required  
    return the field_content 

此代码用于Debug构建,请在脚本中将 assembleDebug 替换为 assembleRelease

将其放置在项目主文件夹中,名称为 .gitlab-ci.yml