ndk
ndk copied to clipboard
Document how to sign apk
Trying to port my library to Android and created a basic example. If I run:
$ cargo apk run --example hello_world_android
from the previously-linked repo, I get:
adb: failed to install C:\Users\Nolan\Projects\TTS-RS\target\debug\apk\examples\hello_wL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl13446t length of null array]
I have ~/.android/debug.keystore and have built and installed Android apps locally before. Looks like it might be possible to configure the use of the debug keystore, but it isn't clear after a bit of digging how. I imagine I'd also want to sign non-example apps with my own key, so knowing how would be helpful.
Thanks!
This appears to have been a bug in a build-tools package. It didn't ship find_java.bat, and instead of telling me that like a sane script would, it silently failed and didn't even generate a non-0 status. Upgrading to the latest build-tools seems to have provided the script, and now everything works. Apologies for the noise.
Though once I'm done porting my library, I'll probably want to port one of my games, and to sign it with a non debug key. Would be nice to know how to do that, but I'm now unblocked for the immediate future.
cargo-apk and xbuild support building signed apks. for release aab's you currently need to use jarsigner after building the aab with xbuild. the main reason being that jarsigner uses some weird keystore format/concept specified in the jdk, so to cleanly integrate signing into xbuild, I'd need to implement it in rust. Tracking this effort here https://github.com/rust-mobile/xbuild/issues/103