-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: Build and Signing Android apps using Flavors #7082
fix: Build and Signing Android apps using Flavors #7082
Conversation
…ix/flavor-signing # Conflicts: # cli/src/android/build.ts
@markemer any thoughts? As it stands, |
Thanks for the contribution. This does seem like a bug that needs fixing - can you run |
Done, thanks @markemer |
can you provide a sample app that reproduces the issue? the issue you referenced got closed because it got no sample app, so providing a fix without providing a way of reproducing doesn't help much. |
Sure thing, repo here: https://github.com/bosh-code/android-flavor-example As you can see, the flavor is ignored and all flavors are built, as well as all cases fail to sign. You can use the keystore credentials in the script to run a build through android studio and verify they are correct and it is just that the path of the unsigned apk/bundle is incorrect. In the original project I encountered this bug in I am using Gradle DSL and can confirm the behavior is the same. Please let me know if there is anything else I can help with. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the new code breaks for AAB option, seems like AAB uses the ${flavor}Release
path while APK uses ${flavor}/release
path.
I have not tested on windows yet, but I think appending the /release
for APK path may lead to bad windows paths, using join
should be preferred.
Good catch, thank you. I do not have access to a Windows machine, but I suspect you are right. I have added a bit of logic that should fix it. Thanks |
This comment was marked as abuse.
This comment was marked as abuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I've verified that it works on windows too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me on mac - haven't tried windows but @jcesarmobile has
Co-authored-by: Mark Anderson <[email protected]> Co-authored-by: jcesarmobile <[email protected]>
It appears that the
flavor
argument was left off when reading in a build command. So it wasn't present in theconfig
object or thebuildOptions
when running android build.When constructing the unsigned .apk/.aab name, the const
flavor
is already defined to be used else where, but not when signing, so I update it to use that variable.When an app is built with a flavor, the expected path was:
android/app/build/outputs/apk/<flavor>Release/<apk/bundle name>
However it should actually be:
android/app/build/outputs/apk/<flavor>/release/<apk/bundle name>
This issue was raised previously for it: #6215