If you develop Android applications with Sublime Text, you might find it useful to use its built-in building system to debug your application instead of switching every time to a terminal. I made a simple build system config file which allows you to do the most common operations without leaving the editor.
The build system
- First, open Tools > Build System > New Build System…. A new file will open.
- Paste the content of this gist into the window.
- Go to Save; add a new directory named Buildozer; save the file into that directory and name it Buildozer.sublime-build
Done! Now go to your Buildozer application, reopen Tools > Build System and you should find a new option waiting to be enabled!
The keyboard shortcuts
Now, if you want my custom keyboard shortcuts too, you need to follow just a few more steps.
- Go to Preferences > Key Bindings – User.
- Paste the content of this gist into that file.
- Save and done!
The keybindings are the following:
- Ctrl+B: will build the project in debug mode.
- Ctrl+Shift+B: will run the main.py script in the current file’s directory (useful to run the program even while editing the .kv file).
- Super+R: will build the project in release mode; you will need to sign it before using it.
- Super+B: will build the project in debug mode, push it to the connected ADB devices and run it.
- Super+Shift+B: same as above, but instead of rebuilding it, it will push and run an existing build.
- Super+E: will serve the bin directory through HTTP. Remember to stop the server from Tools > Cancel Build once you have downloaded the files on your device.
(note: Super is usually the “Windows” or the “Command” key in most keyboards, unless you changed its logo like I did 😉 )
Kv Syntax Highlighting
Just a little cherry on top: syntax highlighting on Kv. The Kivy team has already prepared that for us: let’s install it!
- Go to Tools > New Plugin…
- Delete the default content of the file and paste the content of this file.
- Go to Save; add a new directory named Kivy and save this file into it; name it kivy.tmLanguage
Done! Now go to your .kv, press the syntax highlighting menu on the bottom right and select Kivy Language 🙂
Non-advertised versions of the previous links
It would be really nice from you if you would use the advertised links, but if you don’t want to, I understand: I hate ads too! 🙂 But they support my work!
- Buildozer.sublime-build gist: direct link, advertised link
- Keyboard shortcuts gist: direct link, advertised link
- Syntax highlighting: direct link, advertised link
Have fun! 🙂