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

--release signing not working on cordova-android 9.0.0 #1020

Closed
3 tasks done
Infradigitaal opened this issue Jul 6, 2020 · 6 comments
Closed
3 tasks done

--release signing not working on cordova-android 9.0.0 #1020

Infradigitaal opened this issue Jul 6, 2020 · 6 comments

Comments

@Infradigitaal
Copy link

Bug Report

I'm trying to build my app on android@9.0.0 with the command cordova build android --release. However, it simply deletes my
release-signing.properties and produces only an unsigned APK.

Problem

My app release build won't sign and my release-signing.properties gets deleted. No errors are shown.

What is expected to happen?

For the app to build

What does actually happen?

The app doesn't build

Information

It still works perfectly fine on building cordova-android 8.0.0

I simply paste my keystorefile (jks) and release-signing.properties into the android platform folder, and use the --release command to build.

Command or Code

cordova build android --release

Environment, Platform, Device

Windows 10

Version information

Cordova CLI 9.0.1
Android 9.0.0
Basic Cordova CLI
Windows 10
Android SDK tools (CLI version)

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@breautek
Copy link
Contributor

breautek commented Jul 6, 2020

The files under platforms/android are managed, so manually changing files I don't think was ever an officially supported feature, and definitely not recommended.

Instead you should use a build.json file that is placed at the root of your cordova project to specify your keystore. See the docs for more information using a build.json file.

@Infradigitaal
Copy link
Author

Oh... Well alright. I just did that and now it's giving me an error in cordova.gradle line: 138

I checked the file out and that line seems to be the dialog call for doPromptForPassword. Is this related? (I filled out the password in the build.json)

@Infradigitaal
Copy link
Author

Nevermind, I got it working. It for whatever reason deleted my passwords from the build.json after the first try, it would seem.

But this does mean there might still be a bug

the documentation you linked to stated it should prompt you for a password if you don't fill it out in the build.json, but that gives an error.

@breautek
Copy link
Contributor

breautek commented Jul 7, 2020

I've reproduced the password prompt issue. I've created an issue that specifically describes the password prompt issue. Thank you for bringing attention to that... Based on some research on why gradle was crashing, this seemed like it was an issue in Cordova for awhile 😕

But I have a PR that I'll be preparing a PR for that shortly.

Regarding password being deleted from build.json, that's really weird, but since it looks like you got it sorted out I'll be closing this issue. If that problem you described persists, please do open a new issue for it.

@breautek breautek closed this as completed Jul 7, 2020
@goffioul
Copy link
Contributor

goffioul commented Aug 27, 2020

I understand that you shouldn't create files manually in platforms/android, but you could have a hook that generate the files automatically before build. This technique is actually documented in https://cordova.apache.org/docs/en/latest/guide/platforms/android/#project-configuration. Given that the default values for cdvReleaseSigningPropertiesFile and cdvDebugSigningPropertiesFile are also documented, it's not difficult to come up with a scheme where these default signing files are generated by a hook script as part of the build process. Something that doesn't work anymore in 9.0.0 due to this commit 3712619. In the previous implementation, there was a check to verify the signing properties file was auto-generated or not. This is now gone. It would probably be useful to document clearly that the default values for cdvReleaseSigningPropertiesFile and cdvDebugSigningPropertiesFile shouldn't be used, because the corresponding files will be deleted on each build.

@ls-1N
Copy link

ls-1N commented Dec 9, 2022

I spent quite a few days figuring out why our Cordova upgrade is breaking before landing here and learning that the .properties file can not be in platforms/android anymore. 🥲

I agree with @goffioul that documentation could be improved here. I can make a PR if the idea is approved.

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

No branches or pull requests

4 participants