Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Signing with build command still not working in 6.0.0-rc.0? #7299

Closed
1 of 3 tasks
AlansCodeLog opened this issue Feb 28, 2024 · 6 comments · Fixed by #7365
Closed
1 of 3 tasks

[Bug]: Signing with build command still not working in 6.0.0-rc.0? #7299

AlansCodeLog opened this issue Feb 28, 2024 · 6 comments · Fixed by #7365
Assignees
Labels
cli type: bug A confirmed bug report

Comments

@AlansCodeLog
Copy link

AlansCodeLog commented Feb 28, 2024

Capacitor Version

Latest Dependencies:

@capacitor/cli: 5.7.0
@capacitor/core: 5.7.0
@capacitor/android: 5.7.0
@capacitor/ios: 5.7.0

Installed Dependencies:

@capacitor/ios: not installed
@capacitor/cli: 6.0.0-rc.0
@capacitor/core: 5.7.0
@capacitor/android: 5.7.0

[success] Android looking great! 👌

Other API Details

npm: 10.2.4 
node: v20.11.1

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

I ran into this issue #7054.

It was supposedly solved, so I upgraded the cli to 6.0.0-rc.0 but I was still getting an error:

Failed to load signer "signer #1"
java.io.IOException: Unsupported password spec for Key "app" password for signer #1: PASSWORD
        at com.android.apksigner.PasswordRetriever.getPasswords(PasswordRetriever.java:191)
        at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:293)
        at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181)
        at com.android.apksigner.ApkSignerTool.getSignerConfig(ApkSignerTool.java:405)
        at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:324)
        at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88)

I printed out the apksigner command run to try to run it myself but it also gave the same error. Eventually tried passing --key-pass the password with pass: (because unlike --ks-pass it was not added) and then it worked.

apksigner sign ... --ks-pass pass:PASSWORD ... --key-pass pass:PASSWORD

So what seems to be happening is this line is not adding pass:.

signingArgs.push('--key-pass', buildOptions.keystorealiaspass);

I can submit PR to fix, but also would it not be better to allow the user to specify this and somewhere in the documentation + CapacitorConfig types link to the apksigner docs? which allow more options than just pass: like env: and file: which can be very useful. https://developer.android.com/tools/apksigner#:~:text=%2D%2Dkey%2Dpass%20%3Cinput%2Dformat%3E

Expected Behavior

I would expect to be able to either pass the password without pass in both cases or better docs/error + enforcement of pass/env/file: prefix.

Project Reproduction

Repo
Build web project, add android with capacitor, then try to do npm run cap:build. I added a script to be sure it uses the project's pinned 6.0.0 cli.
Keystore is included with password 123456 for both passwords an key alias "key"`.

Additional Information

If anybody runs into this, as a workarround you can do something like this in the capacitor.config.ts:

{
	// ...
	android: {
		buildOptions: {
			// ...
			keystoreAliasPassword: `pass:${process.env.ANDROID_KS_ALIAS_PASSWORD}`,
		},
	},
}
@jcesarmobile jcesarmobile added the needs reproduction needs reproducible example to illustrate the issue label Feb 29, 2024
Copy link

ionitron-bot bot commented Feb 29, 2024

This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed.
Please see the Contributing Guide for how to create a Sample App.
Thanks! Ionitron 💙

@ionitron-bot ionitron-bot bot removed the triage label Feb 29, 2024
@Ionitron Ionitron added needs reply needs reply from the user and removed needs reply needs reply from the user labels Feb 29, 2024
@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Feb 29, 2024
@AlansCodeLog
Copy link
Author

Added repro.

@Ionitron Ionitron removed the needs reply needs reply from the user label Mar 2, 2024
@markemer
Copy link
Contributor

Have you tried this with 6.0.0-rc.1? Let me know if it's still broken.

@markemer markemer self-assigned this Mar 19, 2024
@jcesarmobile jcesarmobile added cli type: bug A confirmed bug report and removed needs reproduction needs reproducible example to illustrate the issue labels Mar 21, 2024
Copy link

ionitron-bot bot commented Mar 21, 2024

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

@jcesarmobile
Copy link
Member

I've tested on the provided app and it's still broken, looks like there was a typo when making the requested changes

Copy link

ionitron-bot bot commented Apr 24, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli type: bug A confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants