Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Illegal option when using expo build:android with a keystore alias that starts with "-" #60

Closed
zaytri opened this issue May 7, 2019 · 6 comments
Assignees

Comments

@zaytri
Copy link

zaytri commented May 7, 2019

Description

I am manually uploading an existing keystore using expo build:android, and the alias that I need to use has a leading "-", for example: -myAlias. When prompting for the keystore alias, that's what I type in.

? Keystore Alias: -myAlias

Expected Behavior

I thought it would work fine, I even tried all of these options to attempt to escape the "-" character: https://stackoverflow.com/a/26453747

Observed Behavior

It seemed like everything was successful, but I was unable to install the app, so I checked the build logs and saw this under signing created apk:

[stderr] Illegal option: -myAlias
Please type jarsigner -help for usage
jarsigner exited with non-zero code: 1

Environment

I am using Expo Cli 2.17.0

@zaytri
Copy link
Author

zaytri commented May 8, 2019

I did some testing with jarsigner, I couldn't get it to accept an alias with a leading "-" at all. I was finally able to sign the app, I took the apk that Expo generated and manually signed it using zipalign then apksigner, and thankfully apksigner accepts an alias surrounded by quotes: "-myAlias".

zipalign -v -p 4 my-app-generated-by-expo-signed.apk my-app-unsigned-aligned.apk
apksigner sign --ks my-release-key.jks --ks-key-alias "-myAlias" --out my-app-release.apk my-app-unsigned-aligned.apk

It's inconvenient but it works.

@cruzach
Copy link
Contributor

cruzach commented May 8, 2019

Hi @zaytrix!

I'm looking into this (glad you found a workaround in the meantime), but could you either share more of the build logs or send me your build id so I can take a look at them?

Thanks!
Charlie

@zaytri
Copy link
Author

zaytri commented May 8, 2019

Here's my build id: afef4c23-dc1c-4cbc-991f-ccbb4f92a6d8
(I assume it's the one in the url when viewing the build)

Thanks for your help @cruzach!

@cruzach
Copy link
Contributor

cruzach commented May 8, 2019

Update for you @zaytrix- we're looking into this internally, thanks so much for bringing it to our attention 😊

I'll post any updates/info here as they come along

@dsokal dsokal transferred this issue from expo/expo-cli May 9, 2019
@dsokal dsokal self-assigned this May 9, 2019
@dsokal
Copy link
Contributor

dsokal commented May 9, 2019

Hello @zaytrix,
thanks for reporting. Unfortunately, there is nothing we can do about it. This is how jarsigner works and we're not going to change the way we sign .apk files for SDK 31 (this is the version you're using). It was changed in SDK 32 and we don't use jarsigner there.
You have two options here: you can either change the alias in your keystore or upgrade your project to SDK 32.

@dsokal dsokal closed this as completed May 9, 2019
@zaytri
Copy link
Author

zaytri commented Jun 7, 2019

I've upgraded my project to SDK 33 and I can confirm that it works!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants