|
| 1 | +# Dev setup |
| 2 | + |
| 3 | +For general instructions on setting up to do development |
| 4 | +on this app, [see the README][readme-setup]. |
| 5 | + |
| 6 | +This file covers specific topics in more detail. |
| 7 | + |
| 8 | +[readme-setup]: https://github.com/zulip/zulip-flutter#setting-up |
| 9 | + |
| 10 | + |
| 11 | +## Android without Android Studio |
| 12 | + |
| 13 | +The standard [Flutter installation guide](https://docs.flutter.dev/get-started/install) |
| 14 | +calls for installing Android Studio in order to build for Android. |
| 15 | +This is the recommended option where possible; but for use cases |
| 16 | +like building the app on a remote server in the cloud, you may want |
| 17 | +to set things up without Android Studio. |
| 18 | + |
| 19 | +To set up the development environment on Linux without Android Studio: |
| 20 | + |
| 21 | +1. Follow the [Flutter installation guide](https://docs.flutter.dev/get-started/install), |
| 22 | + up until the step calling for Android Studio. |
| 23 | + |
| 24 | +2. Install Java, specifically JDK 17 (or later?): |
| 25 | + `sudo apt install openjdk-17-jdk` |
| 26 | + |
| 27 | +3. Install the Android SDK. This might look like the following: |
| 28 | + |
| 29 | + ``` |
| 30 | + # Download Android SDK cmdline-tools: https://developer.android.com/studio#command-line-tools-only |
| 31 | + $ curl -LO https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip |
| 32 | + $ mkdir -p ~/Android/Sdk/cmdline-tools/latest |
| 33 | + $ unzip commandlinetools-linux-11076708_latest.zip -d ~/Android/Sdk/cmdline-tools/latest |
| 34 | + $ mv ~/Android/Sdk/cmdline-tools/latest/cmdline-tools/* ~/Android/Sdk/cmdline-tools/latest |
| 35 | + $ rmdir ~/Android/Sdk/cmdline-tools/latest/cmdline-tools |
| 36 | + # Add "$HOME/Android/Sdk/cmdline-tools/latest/bin" to PATH. |
| 37 | + # Set environment variable ANDROID_HOME to "$HOME/Android/Sdk". |
| 38 | + $ sdkmanager platform-tools |
| 39 | + ``` |
| 40 | + |
| 41 | +4. Resume following the Flutter installation guide |
| 42 | + starting from the step after installing Android Studio. |
| 43 | + Use the Flutter `main` channel, just like in |
| 44 | + [our standard setup instructions][readme-setup]. |
| 45 | + |
| 46 | +5. Build the app with `flutter build apk` |
| 47 | + or `flutter build apk --debug`, and |
| 48 | + download the resulting APK file to your local machine. |
| 49 | + Then use `adb install` (see `adb help` for help) |
| 50 | + to install it on either a physical or emulated device, |
| 51 | + and run it. |
| 52 | + |
| 53 | + (Have you tried setting things up so that you can use |
| 54 | + `flutter run` on the remote machine, and get hot reload? |
| 55 | + If so, we'd be glad to hear instructions for it; |
| 56 | + please start a thread in our [`#mobile-dev-help`][] channel, |
| 57 | + or send a PR.) |
| 58 | + |
| 59 | +[`#mobile-dev-help`]: https://chat.zulip.org/#narrow/stream/516-mobile-dev-help |
0 commit comments