Update asset, rebuild quickly - gradle command line for that?

Does anybody know the command line to repeat the build process for a temporary build directory (found on disk after “Run in emulator”)? The Processing for Android site states unter ‘What’s new in version 4’: “The export project option in the PDE will now create a Gradle project that you can build directly from the command line”.

My goal is to replace one (1) file in the app’s assets directory and re-build as quickly as possible, as I plan to give each user of my sofware an individual apk with an individual file (via my own site, not Play Store).

If a command line build wouldn’t be much faster than building through PDE: Alternatively, I’m looking for a command line to re-sign an apk (the one generated by “Run in Emulator”) with the developer key after replacing a file in the apk (unzip, replace file in app’s assets directory, zip, sign).

looking for a command line to re-sign an apk … after replacing a file in the apk

Googled a bit:

  1. Begin build with “Run in Emulator” in Processing’s Android mode

  2. Build path is displayed at beginning of build process, remember (copy), e.g. C:\Users<Username>\AppData\Local\Temp\android4985002123845272925sketch

  3. After build, find apk in that build directory, e.g. “…exampleandroid_debug.apk” (… stands for full path)

  4. Unpack with WinZip (temporarily change suffix to .zip), change as desired, re-pack with WinZip

  5. Run zipalign: \sdk\build-tools\26.0.2\zipalign 4 “…exampleandroid_debug.apk” “…exampleandroid_aligned.apk”

  6. Sign with debug key: \sdk\build-tools\26.0.2\apksigner sign --ks C:\Users<Username>.android\debug.keystore --ks-pass pass:android --out “…result.apk” “…exampleandroid_aligned.apk”

1 Like

Thanks for sharing the answer with the forum :+1: