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

**URL:** https://discourse.processing.org/t/update-asset-rebuild-quickly-gradle-command-line-for-that/4114
**Category:** Processing for Android
**Created:** [October 4, 2018, 8:26am UTC](https://discourse.processing.org/t/update-asset-rebuild-quickly-gradle-command-line-for-that/4114 "2018-10-04T08:26:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dtmr](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@dtmr](https://discourse.processing.org/u/dtmr)
#### Post date: [October 4, 2018, 8:26am UTC](https://discourse.processing.org/t/update-asset-rebuild-quickly-gradle-command-line-for-that/4114/1 "2018-10-04T08:26:14Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![dtmr](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@dtmr](https://discourse.processing.org/u/dtmr)
#### Post date: [October 5, 2018, 6:01pm UTC](https://discourse.processing.org/t/update-asset-rebuild-quickly-gradle-command-line-for-that/4114/2 "2018-10-05T18:01:58Z")

</div>

> 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”

---

<div class="post-metadata">

### Author: ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)
#### Post date: [October 5, 2018, 7:58pm UTC](https://discourse.processing.org/t/update-asset-rebuild-quickly-gradle-command-line-for-that/4114/3 "2018-10-05T19:58:51Z")

</div>

Thanks for sharing the answer with the forum 👍
