Setting up the Development Environment
Requirements
You'll need a recent:
- Rustup setup for Rust
- Android NDK / XCode setup for the target - and device or simulator set up
- flutter
- on Linux you additionally need:
libsecret-1-0( &libsecret-1-dev),mpv(&libmpv-dev) andlibjsoncpp-devon Ubuntu with apton Arch with pamac
Setup
You need cargo make for managing and building the native core artifacts. Install via cargo install cargo-make
Then you run the init once in the root of the repository:
cargo make setup
You also need to build the core SDK once first:
Building for SDK
Whenever the native SDK changed, you need to (re)build the artifacts. To do that you can use the one of following commands
cargo make android
cargo make ios
cargo make desktop
.Note: currently only android is fully supported. Plumbing for iOS is existing but not tested, Web, Linux, Mac, Windows and are platforms have not been configured yet.
Running the App
Once the SDK is rebuilt, you can run the flutter as usual on your device or emulator per:
F5 in VS Code or flutter run in app directory
If you want to run flutter as desktop in windows:
flutter run -d windows
Speed up Building
It takes a long time to execute full build. You can rebuild only changes of source files to save your building time meaningfully.
cargo make android-dev It can reduce the size in architecture. This will build only x86_64 of rust library. (build only rust) 682.6s -> 120.31s
cargo make --profile release android-dev It can reduce the size by release mode. It can reduce the size to about a half, because size in release mode is smaller than one in debug mode.
flutter run --no-build (only flutter changed) 85.0s -> 42.6s
Troubleshooting
Login issues
The development version of Acter is, unless you change the environment variables. pointing to a specific development instance of Synapse without public registration (called m-1), so registering with the default code and logging in with the usual Acter username you might registered in the production systems won't work directly.
But if you just use the full matrix-id (so @ then the username + : servername, so e.g. @ben:acter.global ) as the username Acter will automatically talk to the right server and login should work regardless (if the server supports password authentication).
NDK compile error
The setup required NDK of 27 and cargo-ndk > 3.0. It has been tested and its nightly is built against 27.2.12479018 with cargo-ndk 3.3.0.
APK compile error
Install Android Studio 2024-2.1.9 because it contains jbr that jdk version is 21.0.3. gradle-8.9-bin and com.android.application 8.7.1 needs java 21.
You may get error in com.android.internal.version-check after upgrade of gradle. Please remove the build directory in app and the .gradle directory in app/android, then do fresh build using flutter clean.
Android 7.0 (api 24) emulator was tested successfully on Android Studio 2024-2.1.9.
Android Build in Windows
- 35GB of HDD needed for project building. It doesn't cover android emulator vm.
- Run
cargo install cargo-makeso thatcargo makecan be executed. - Run
cargo make androidin root directory. - Open sdk manager in android studio and install
Google Play x86_64 API 30image andAndroid SDK Platform 30.
API 31+image is not launching in windows for now.- This apk is not working on
x86image ofAPI 30. API 32doesn't containx86image now.
- Open virtual device manager in android studio and create vm using
Google Play x86_64 API 30image.
- 4GB of internal storage is recommended, because apk size of this project is 500+MB.
- Launch android emulator.
- Change to
appdirectory and runflutter run.
Flutter package file_picker error in android 6.0
FilePickerDelegate occurs error in getSlotFromBufferLocked() under android 6.0. This issue was fixed android 7.0. Please read this comment. Now minimum version of android is 7.0.
CocoaPods issue in iOS build
You may get the error message Invalid argument @ io_fread during compilation of rust library. cocoapods is using ruby-macho and ruby-macho occurs the crash about big input file. iOS simulator uses x86_64-apple-ios architecture. The size of our library libacter.a is as following: Debug build: 717MB Release build: 223MB When using release build of libacter.a, the error Invalid argument @ io_fread disappeared. The compile command of release build is the following: cargo make --profile release ios