diff --git a/.gitignore b/.gitignore index 29b579d..c99ad71 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,7 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + + +/key.jks +/android/key.properties \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b51f2f..4df9dec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,9 +28,14 @@ build_web: - build/web/ -build_android: +build_android_fdroid: stage: coverage script: + - cd android && echo $FDROID_KEY | base64 --decode --ignore-garbage > key.jks && cd .. + - cd android && echo "storePassword=${FDROID_KEY_PASS}" >> key.properties && cd .. + - cd android && echo "keyPassword=${FDROID_KEY_PASS}" >> key.properties && cd .. + - cd android && echo "keyAlias=key" >> key.properties && cd .. + - cd android && echo "storeFile=../key.jks" >> key.properties && cd .. - flutter build apk --release artifacts: when: on_success diff --git a/android/app/build.gradle b/android/app/build.gradle index a7e3441..faf963e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -25,6 +25,12 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + android { compileSdkVersion 28 @@ -37,7 +43,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "chat.fluffy.fluffychat" minSdkVersion 16 targetSdkVersion 28 @@ -46,11 +51,21 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile file(keystoreProperties['storeFile']) + storePassword keystoreProperties['storePassword'] + } + } buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig signingConfigs.release + minifyEnabled true + useProguard true + + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d5fc4f2..95392b8 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -8,7 +8,7 @@