Improve app setup

This commit is contained in:
Hillel Coren 2019-05-28 12:44:05 +03:00
parent 8cf3005d13
commit 48ca6702ce
4 changed files with 68 additions and 5 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ key.properties
google-services.json
GoogleService-Info.plist
ios/Runner/Info.plist
android/app/build.gradle

View File

@ -48,9 +48,19 @@ The architecture is based off these two projects:
- [Additional thoughts](https://hillelcoren.com/2018/08/24/ongoing-adventures-with-flutter-and-redux/)
## Developer Notes
- Run `cp lib/.env.dart.example lib/.env.dart` to create the config file
- Run `cp lib/.env.dart.example lib/.env.dart` to create the config file.
- Run `cp android/app/build.gradle.dev android/app/build.gradle` to support running the code unsigned.
- Run `flutter run` while you have a device connected to the computer or an emulator running and now you can run it.
### Code generation
- Run `flutter packages pub run build_runner build --delete-conflicting-outputs` to regenerate the model files. It will also remove the old generated files so conflicts are avoided..
### Tests
- Run `flutter drive --target=test_driver/products_it.dart` to run the tests
### Code Signing
- Run `cp android/app/build.gradle.prod android/app/build.gradle` to support running the code signed
- Run `cp android/key.properties.example android/key.properties` to create the keys file
- Run `flutter packages pub run build_runner build --delete-conflicting-outputs` to regenerate the model files. It will also remove the old generated files so conflicts are avoided.
- Run `keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias invoiceninja` to generate a key to be able to sign the android application.
- Update `android/key.properties` according to the parameters you entered in previous command when you generated the key
- Open a new Firebase project from your console. Firebase is used for authentication.
@ -58,8 +68,6 @@ The architecture is based off these two projects:
- After go to add a new Android application. For the package name add `com.invoiceninja.flutter`
- Press "Register App" button.
- Download "google-services.json" and put it in `android/app` directory.
- Run `flutter run` while you have a device connected to the computer or an emulator running and now you can run it.
- Run `flutter drive --target=test_driver/products_it.dart` to run the tests
## Contributions

View File

@ -0,0 +1,54 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.invoiceninja.flutter"
minSdkVersion 18
targetSdkVersion 27
versionCode 41
versionName "0.1.41"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.5'
}
apply plugin: 'com.google.gms.google-services'