Skip to content

Project Setup

SirSevenG edited this page Dec 19, 2022 · 5 revisions

Android builds from scratch

Linux (Ubuntu)

  • Install Android Studio

  • launch Android Studio, accept all licenses, proceed with standard components installation

  • install git

sudo apt-get update
sudo apt-get install git-all
git version

Don't forget to configure git user credentials

  • Install Android Studio cli
sudo apt update
sudo apt install adb android-sdk
  • clone flutter from official repo

Official instructions

git clone https://github.com/flutter/flutter.git $HOME/flutter
  • make sure you've got flutter binary in your PATH (AE: export PATH="$PATH:$HOME/flutter/bin")

  • set flutter to 2.8.1 version

cd ~/flutter
git fetch
git checkout tags/2.8.1
  • clone mobile repo to the directory with lowercase/underscore name
git clone https://github.com/KomodoPlatform/AtomicDEX-mobile.git $HOME/atomicdex_mobile
  • open $HOME/atomicdex_mobile/android in Android Studio, allow Studio to download correct versions of gradle, java, sdks, etc

  • install Flutter and Dart plugins for Android Studio

  • in terminal run flutter doctor

flutter --version
flutter doctor
# Likely you'll need to accept Android Licenses again
flutter doctor --android-licenses
  • create folders to place api library into:
mkdir -p ~/atomicdex_mobile/android/app/src/main/cpp/libs/arm64-v8a
mkdir -p ~/atomicdex_mobile/android/app/src/main/cpp/libs/armeabi-v7a
  • download required api libraries and extract libmm2.a into respective folders

Builds are available in AtomicDEX-API CI releases

  • build application
cd ~/atomicdex_mobile
flutter create . --org com.komodoplatform.atomicdex
./fetch_coins.sh
flutter build apk  # include build params here, debug build is done by default

Apks can be installed later with adb

  • alternatively connect Android device to your PC via USB and start app directly on it:
cd ~/atomicdex_mobile
flutter create . --org com.komodoplatform.atomicdex
./fetch_coins.sh
flutter run  # include build params here

Windows

  • download and install Android Studio and Android cli tools

  • launch Android Studio, accept all licenses, proceed with standard components installation

  • download and install git

  • clone flutter from official repo or get one here

  • make sure you've got flutter binary in your PATH (Drive:\path\to\flutter\bin)

  • set flutter to 2.8.1 version

cd Drive:\path\to\my\flutter
git fetch
git checkout tags/2.8.1
  • clone mobile repo
git clone https://github.com/KomodoPlatform/AtomicDEX-mobile.git
  • open Drive:\path\to\AtomicDEX-mobile\android in Android Studio, allow Studio to download correct versions of gradle, java, sdks, etc

  • install Flutter and Dart plugins for Android Studio

  • in terminal run flutter doctor

flutter --version
flutter doctor
# Likely you'll need to accept Android Licenses again
flutter doctor --android-licenses
  • create folders to place api library into:
mkdir -p Drive:\path\to\AtomicDEX-mobile\android\app\src\main\cpp\libs\arm64-v8a
mkdir -p Drive:\path\to\AtomicDEX-mobile\android\app\src\main\cpp\libs\armeabi-v7a
  • download required api libraries and extract libmm2.a into respective folders

Builds are available in AtomicDEX-API CI releases

  • build application
cd Drive:\path\to\AtomicDEX-mobile
.\fetch_coins.ps1
flutter build apk  # include build params here, debug build is done by default

Apks can be installed later with adb

  • alternatively connect Android device to your PC via USB and start app directly on it:
cd Drive:\path\to\AtomicDEX-mobile
.\fetch_coins.ps1
flutter run

MacOS

  • Install latest Xcode from AppStore or from apple dev

  • Install Xcode command line tools:

sudo xcode-select --install
sudo xcodebuild -license # accept Xcode licenses
  • Install Android Studio

  • launch Android Studio, accept all licenses, proceed with standard components installation

  • If you don't have hombrew installed get one here

  • install git

brew install git
git version

Don't forget to configure git user credentials

  • Install Android Studio cli
brew install --cask android-sdk
  • clone flutter from official repo

Official instructions

git clone https://github.com/flutter/flutter.git $HOME/flutter
  • make sure you've got flutter binary in your PATH (AE: export PATH="$PATH:$HOME/flutter/bin")

  • set flutter to 2.8.1 version

cd ~/flutter
git fetch
git checkout tags/2.8.1
  • clone mobile repo
git clone https://github.com/KomodoPlatform/AtomicDEX-mobile.git
  • open $HOME/AtomicDEX-mobile/android in Android Studio, allow Studio to download correct versions of gradle, java, sdks, etc

  • install Flutter and Dart plugins for Android Studio

  • in terminal run flutter doctor

flutter --version
flutter doctor
# Likely you'll need to accept Android Licenses again
flutter doctor --android-licenses
  • create folders to place api library into:
mkdir -p ~/AtomicDEX-mobile/android/app/src/main/cpp/libs/arm64-v8a
mkdir -p ~/AtomicDEX-mobile/android/app/src/main/cpp/libs/armeabi-v7a
  • download required api libraries and extract libmm2.a into respective folders

Builds are available in AtomicDEX-API CI releases

  • build application
cd ~/AtomicDEX-mobile
./fetch_coins.sh
flutter build apk  # include build params here, debug build is done by default

Apks can be installed later with adb

  • alternatively connect Android device to your PC via USB and start app directly on it:
cd ~/AtomicDEX-mobile
./fetch_coins.sh
flutter run  # include build params here

Additional info and possible build issues:

Check flutter doctor command, in most cases it will point you to the thing gone wrong and possible solutions. Trying to build application directly in Android Studio may also detect your issues and/or versions incompatibilities.

  • run app on device connected to PC via USB:
flutter run # --release/--prodile, --debug is default if no build type flag is passed
  • confirm device is connected and recognised by the system
flutter devices
  • if error: adb server version (41) doesn't match this client (39); killing...

Make sure android studio is not running, and start adb from CLI

  • install APK over wifi
adb tcpip 5555                # Restarts in TCP mode port: 5555
adb connect 192.168.0.108:5555      # Connects adb to phone
adb install -r ./build/app/outputs/flutter-apk/app-release.apk
  • make sure you have Android cli tools on PATH and available from terminal

For example, try to run android debug bridge

adb device

If you don't want to manage SDK/cli tools manually, in Android Stuido go Settings -> Apperance & Behaviour -> System Settings -> Android SDK -> SDK Tools and make sure command line tools (latest) are installed, you will need to reload Studio after and possibly reboot on Windows

  • your system may not recognize java installed with Android Studio, in this case you will need to install one manually, version 9+

https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html

Requires oracle account for downloads. You may have to reboot your PC(for WIndows) after installation, after reboot make sure you have correct JAVA_HOME Env var.

  • Linux additional adb debugging info:

If error: adb server version (41) doesn't match this client (39); killing...

It's likely a mismatch between system apt adb and studio adb. Search system for other versions of adb, and set the symlink to use the correct one.

ls -la $(which adb)

lrwxrwxrwx 1 root root 43 Nov 2 16:47 /usr/bin/adb -> /home/smk762/Android/Sdk/platform-tools/adb

For udev rules, refer to https://github.com/M0Rf30/android-udev-rules

You might need to put something like SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6864", MODE="0666", GROUP="plugdev", SYMLINK+="android_adb", OWNER="smk762" into **/etc/udev/rules.d/51-android.rules

Run sudo service udev restart so rules take effect. You might also need to start adb with sudo.

iOS builds from scratch

MacOS only

  • Install latest Xcode from AppStore or from apple dev

  • Install Xcode command line tools:

sudo xcode-select --install
sudo xcodebuild -license # accept Xcode licenses
  • If you don't have hombrew installed get one here

  • install git

brew install git
git version

Don't forget to configure git user credentials

  • clone flutter from official repo

Official instructions

git clone https://github.com/flutter/flutter.git $HOME/flutter
  • make sure you've got flutter binary in your PATH (AE: export PATH="$PATH:$HOME/flutter/bin")

  • set flutter to 2.8.1 version

cd ~/flutter
git fetch
git checkout tags/2.8.1
  • clone mobile repo
git clone https://github.com/KomodoPlatform/AtomicDEX-mobile.git
  • in terminal run flutter doctor
flutter --version
flutter doctor
  • download required api library and extract libmm2.a into AtomicDEX-mobile/ios directory

API library builds are available in AtomicDEX-API CI releases

You will need to connect your iOS device to building machine to proceed with next steps

  • Clean cocoapods, generate fresh ones with flutter run
rm -rf ios/Podfile ios/Pods/*
# Make sure you have correct Podfile.lock file and have not removed it!
git checkout ios/Podfile.lock
flutter run  # should fail
  • Setup team credentials in Xcode:

Open AtomicDEX-mobile/ios/Runner.xcworkspace in Xcode

Go Runner > Signing & Capabilities > Signing

Make sure 'Automatically manage signing' checkbox is enabled

Select your personal or dev team account, ensure Bundle ID is unique to you

  • Sign dependancies, resolve FLutter and Xcode conflicts

In Xcode slect your device to be build target (On top of Xcode interface dropdown meny change selection from Runner > Any iOS Device (arm64) to Runner > %user% iPhone )

Run the application (Start the active scheme button on top-left of Xcode interface), expect build to fail

From errors you can access DKPhotoGallery and other unsigned dependanciess, select your certificate to sign them

Now you should be able to build application for your device

  • Run the application from Xcode

To install the build on the device you will need to keep your device unlocked and possibly accept developer as Trusted

To do so on iPhone, go: Settings > General > VPN & Device Management and accept developer and application as Trusted

  • Run flutter release/debug/profile build instead of Xcode one:

After signing dependancies, in Xcode go: Runner > Build Settings > Deployment, here make sure you have iOS 11 as iOS Deployment Target.

You should be able to launch actual flutter build now on your device, dev/app should be still accepted as Trusted and actual devices unlocked during installation step

flutter run --release # --debug or --profile
Clone this wiki locally