https://flutter.dev/docs/get-started/install/macos
-
Download Flutter for macOS
-
Extract
cd ~/development
unzip ~/Downloads/flutter_macos_v1.12.13+hotfix.9-stable.zip
mkdir -p $HOME/development
mv ./flutter $HOME/development/
code ~/.bash_profile
- Add to PATH
export PATH="$HOME/development/flutter/bin:$PATH"
- Note: Install Flutter this way instead in the polkawallet-flutter folder https://github.com/polkawallet-io/polkawallet-flutter/blob/master/.travis.yml#L15
git clone https://github.com/flutter/flutter.git -b stable
./flutter/bin/flutter doctor
./flutter/bin/flutter doctor --android-licenses
cd ./lib/js_service_kusama && yarn install && yarn run build && cd ../..
cd ./lib/js_service_acala && yarn install && yarn run build && cd ../..
cd ./lib/js_service_laminar && yarn install && yarn run build && cd ../..
- Note: If you run
git clone https://github.com/flutter/flutter.git -b beta
orgit clone https://github.com/flutter/flutter.git
(master), then you may get errors when you runflutter run --flavor prod
like:
../../../../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
...
Preferences > Languages & Frameworks > Dart SDK /Users/ls/code/src/ltfschoen/polkawallet-flutter/flutter/bin/cache/dart-sdk
Preferences > Languages & Frameworks > Flutter /Users/ls/code/src/ltfschoen/polkawallet-flutter/flutter
- Refresh terminal
source ~/.bash_profile
- Check for dependencies
flutter upgrade
flutter doctor
flutter doctor --android-licenses
-
Install Android Studio - https://developer.android.com/studio
-
Open Android Studio
- Open Android Studio > Configure > Plugins > search for "Flutter" and "Dart" and install both
-
Download Android Command Line Tools - https://developer.android.com/studio/index.html#downloads
-
Add to PATH
# export ANDROID_HOME=$HOME/.android
export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export PATH="$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH"
source ~/.bash_profile
echo $ANDROID_HOME
sdkmanager --help
adb --help
- Install Xcode
- Install Cocoapods
brew reinstall cocoapods
brew link --overwrite cocoapods
- Install Dart-Flutter VSCode extension
code --install-extension Dart-Code.flutter
- On device do the following otherwise will get error
Device xyz is not authorized.
- USB debugging checkbox "enabled"
- Developer Options > Revoke USB Debugging Authorizations
- Default USB configuration > USB tethering
- Click "OK" in alert that appears labelled "Allow USB debugging?" and select checkbox "Always allow from this computer"
- Reconnect device, then agree to RSA Fingerprint verification window
- Check if device connected
flutter devices -v
flutter devices
- Build according the Polkawallet Flutter README
nvm use v13.12.0
cd ./lib/js_service_kusama && rm yarn.lock && yarn && yarn run build && cd ../../
cd ./lib/js_service_acala && rm yarn.lock && yarn && yarn run build && cd ../../
cd ./lib/js_service_laminar && rm yarn.lock && yarn && yarn run build && cd ../../
flutter doctor -v
flutter clean
flutter run -v
- Uninstall any existing versions of app from the device
- Run on the specific device that is connected, where
flutter devices
returns and id.
flutter run -d 988a1644544349575a30 -v
flutter run -d 988a1644544349575a30 -v --observatory-port 8888 --disable-service-auth-codes lib/main.dart
- To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
flutter packages pub run build _runner watch
- Build apk. See https://flutter.dev/docs/deployment/android#build-an-apk
Sign app
Create keystore
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
Reference keystore from app
touch ./android/key.properties
Add to .gitignore
/android/key.properties
Add to contents of key.properties file:
storePassword=
keyPassword=
keyAlias=key
storeFile=/Users/ls/key.jks
Add password that was used when running keytool
in sections above
Edit /android/app/build.gradle
Replace with:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
// storeFile rootProject.file("app/key.jks")
// storePassword System.getenv("APPCENTER_KEYSTORE_PASSWORD")
// keyAlias System.getenv("APPCENTER_KEY_ALIAS")
// keyPassword System.getenv("APPCENTER_KEY_PASSWORD")
}
}
Build APK
flutter build apk --split-per-abi
Upload APK files to https://drive.google.com/drive/u/1/folders/1-QmI0dhlhw6jXqwIuQuuNqZi3uny5hvu, those that were generated in: build/app/outputs/apk/release/
Go to https://appcenter.ms/orgs/MXC-Foundation-gGmbH/apps/DHXDashAndroid/build/branches
Follow the "AppCentre Setup" instructions here https://buildflutter.com/deploying-flutter-apps-via-appcenter/
Add all environment variables from .env file
Notify "Collaborators/QA"
-
Restart device and computer (still get issues)
-
Run the
flutter channel master; flutter upgrade
before runningflutter run ...
-
Debug device logs by running the following in a different terminal window
adb shell
> logcat
adb kill-server
Or run the following before running on device to see what Observatory port is connected
adb logcat -e flutter\|Observatory
adb logcat -e flutter\|Observatory *:I
I've gone through these related issues:
flutter/flutter#25455 flutter/flutter#33214 flutter/flutter#19770 flutter/flutter#51269 https://medium.com/flutter-community/hot-reload-for-flutter-integration-tests-e0478b63bd54
Install VS Code Flutter Dart from https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✗] Xcode - develop for iOS and macOS ✗ Xcode installation is incomplete; a full installation is necessary for iOS development. Download at: https://developer.apple.com/xcode/download/ Or install Xcode via the App Store. Once installed, run: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install: sudo gem install cocoapods
-
Setup Android Device
- Enable USB Debugging
- Plugin the device using USB
- Run
flutter devices
to check Flutter recognizes the device
-
Configure graphics acceleration - https://developer.android.com/studio/run/emulator-acceleration
- AVD Manager > Create Virtual Device > Pixel 2 > Android 9
iOS - flutter attach --debug-uri
- flutter/flutter#33214 (comment)
flutter emulators --create --name pixel
sdkmanager "system-images;android-27;google_apis_playstore;x86