refactor: Migrate android gradle plugin
This commit is contained in:
parent
a928ecec1e
commit
3f02c5010b
4 changed files with 63 additions and 92 deletions
|
|
@ -1,3 +1,10 @@
|
||||||
|
plugins {
|
||||||
|
id "com.android.application"
|
||||||
|
id "kotlin-android"
|
||||||
|
id "dev.flutter.flutter-gradle-plugin"
|
||||||
|
//id "com.google.gms.google-services"
|
||||||
|
}
|
||||||
|
|
||||||
def localProperties = new Properties()
|
def localProperties = new Properties()
|
||||||
def localPropertiesFile = rootProject.file('local.properties')
|
def localPropertiesFile = rootProject.file('local.properties')
|
||||||
if (localPropertiesFile.exists()) {
|
if (localPropertiesFile.exists()) {
|
||||||
|
|
@ -6,11 +13,6 @@ if (localPropertiesFile.exists()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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.")
|
|
||||||
}
|
|
||||||
|
|
||||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||||
if (flutterVersionCode == null) {
|
if (flutterVersionCode == null) {
|
||||||
flutterVersionCode = '1'
|
flutterVersionCode = '1'
|
||||||
|
|
@ -21,10 +23,6 @@ if (flutterVersionName == null) {
|
||||||
flutterVersionName = '1.0'
|
flutterVersionName = '1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
||||||
|
|
||||||
def keystoreProperties = new Properties()
|
def keystoreProperties = new Properties()
|
||||||
def keystorePropertiesFile = rootProject.file('key.properties')
|
def keystorePropertiesFile = rootProject.file('key.properties')
|
||||||
if (keystorePropertiesFile.exists()) {
|
if (keystorePropertiesFile.exists()) {
|
||||||
|
|
@ -85,9 +83,6 @@ flutter {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
//implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698
|
//implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698
|
||||||
implementation 'androidx.multidex:multidex:2.0.1'
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
//apply plugin: 'com.google.gms.google-services'
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,3 @@
|
||||||
buildscript {
|
|
||||||
ext.kotlin_version = '1.8.0'
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
//classpath 'com.google.gms:google-services:4.3.8'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,26 @@
|
||||||
include ':app'
|
pluginManagement {
|
||||||
|
def flutterSdkPath = {
|
||||||
|
def properties = new Properties()
|
||||||
|
file("local.properties").withInputStream { properties.load(it) }
|
||||||
|
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||||
|
return flutterSdkPath
|
||||||
|
}()
|
||||||
|
|
||||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||||
def properties = new Properties()
|
|
||||||
|
|
||||||
assert localPropertiesFile.exists()
|
repositories {
|
||||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
plugins {
|
||||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
id "com.android.application" version "7.1.2" apply false
|
||||||
|
id "org.jetbrains.kotlin.android" version "1.8.0" apply false
|
||||||
|
// id "com.google.gms.google-services" version "4.3.8" apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
include ":app"
|
||||||
|
|
@ -1,32 +1,24 @@
|
||||||
diff --git a/android/app/build.gradle b/android/app/build.gradle
|
diff --git a/android/app/build.gradle b/android/app/build.gradle
|
||||||
index bf972f30..46cebdc6 100644
|
index 7520ff2a..ae376d9d 100644
|
||||||
--- a/android/app/build.gradle
|
--- a/android/app/build.gradle
|
||||||
+++ b/android/app/build.gradle
|
+++ b/android/app/build.gradle
|
||||||
@@ -70,6 +70,10 @@
|
@@ -2,7 +2,7 @@ plugins {
|
||||||
}
|
id "com.android.application"
|
||||||
release {
|
id "kotlin-android"
|
||||||
signingConfig signingConfigs.release
|
id "dev.flutter.flutter-gradle-plugin"
|
||||||
+ minifyEnabled false
|
- //id "com.google.gms.google-services"
|
||||||
+ shrinkResources false
|
+ id "com.google.gms.google-services"
|
||||||
+
|
|
||||||
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// https://stackoverflow.com/a/77494454/8222484
|
|
||||||
@@ -78,8 +82,11 @@ flutter {
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
- //implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698
|
|
||||||
+ implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698
|
|
||||||
+ testImplementation 'junit:junit:4.12'
|
|
||||||
+ androidTestImplementation 'androidx.test:runner:1.1.1'
|
|
||||||
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
|
||||||
implementation 'androidx.multidex:multidex:2.0.1'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-//apply plugin: 'com.google.gms.google-services'
|
def localProperties = new Properties()
|
||||||
+apply plugin: 'com.google.gms.google-services'
|
@@ -83,6 +83,6 @@ flutter {
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
- //implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698
|
||||||
|
+ implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698
|
||||||
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
|
}
|
||||||
diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro
|
diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro
|
||||||
index d0e0fbc9..0a546da0 100644
|
index d0e0fbc9..0a546da0 100644
|
||||||
--- a/android/app/proguard-rules.pro
|
--- a/android/app/proguard-rules.pro
|
||||||
|
|
@ -93,42 +85,25 @@ index d9930f55..510e9845 100644
|
||||||
}
|
}
|
||||||
-*/
|
-*/
|
||||||
\ No newline at end of file
|
\ No newline at end of file
|
||||||
diff --git a/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt b/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt
|
diff --git a/android/settings.gradle b/android/settings.gradle
|
||||||
index 1afc4606..894d1571 100644
|
index b2fd960a..fdb01a4d 100644
|
||||||
--- a/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt
|
--- a/android/settings.gradle
|
||||||
+++ b/android/app/src/main/kotlin/chat/fluffy/fluffychat/MainActivity.kt
|
+++ b/android/settings.gradle
|
||||||
@@ -7,13 +7,11 @@ import android.content.Context
|
@@ -20,7 +20,7 @@ plugins {
|
||||||
import androidx.multidex.MultiDex
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
|
id "com.android.application" version "7.1.2" apply false
|
||||||
class MainActivity : FlutterActivity() {
|
id "org.jetbrains.kotlin.android" version "1.8.0" apply false
|
||||||
-
|
- // id "com.google.gms.google-services" version "4.3.8" apply false
|
||||||
override fun attachBaseContext(base: Context) {
|
+ id "com.google.gms.google-services" version "4.3.8" apply false
|
||||||
super.attachBaseContext(base)
|
|
||||||
MultiDex.install(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
-
|
|
||||||
override fun provideFlutterEngine(context: Context): FlutterEngine? {
|
|
||||||
return provideEngine(this)
|
|
||||||
}
|
|
||||||
diff --git a/android/build.gradle b/android/build.gradle
|
|
||||||
index bd394967..2e9d54de 100644
|
|
||||||
--- a/android/build.gradle
|
|
||||||
+++ b/android/build.gradle
|
|
||||||
@@ -8,7 +8,7 @@ buildscript {
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
- //classpath 'com.google.gms:google-services:4.3.8'
|
|
||||||
+ classpath 'com.google.gms:google-services:4.3.8'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include ":app"
|
||||||
|
\ No newline at end of file
|
||||||
diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart
|
diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart
|
||||||
index 8e67ae92..da4da5c3 100644
|
index 039dde89..1cefdd71 100644
|
||||||
--- a/lib/utils/background_push.dart
|
--- a/lib/utils/background_push.dart
|
||||||
+++ b/lib/utils/background_push.dart
|
+++ b/lib/utils/background_push.dart
|
||||||
@@ -39,7 +39,7 @@ import '../config/setting_keys.dart';
|
@@ -38,7 +38,7 @@ import '../config/setting_keys.dart';
|
||||||
import '../widgets/matrix.dart';
|
import '../widgets/matrix.dart';
|
||||||
import 'platform_infos.dart';
|
import 'platform_infos.dart';
|
||||||
|
|
||||||
|
|
@ -137,7 +112,7 @@ index 8e67ae92..da4da5c3 100644
|
||||||
|
|
||||||
class NoTokenException implements Exception {
|
class NoTokenException implements Exception {
|
||||||
String get cause => 'Cannot get firebase token';
|
String get cause => 'Cannot get firebase token';
|
||||||
@@ -64,7 +64,7 @@ class BackgroundPush {
|
@@ -63,7 +63,7 @@ class BackgroundPush {
|
||||||
|
|
||||||
final pendingTests = <String, Completer<void>>{};
|
final pendingTests = <String, Completer<void>>{};
|
||||||
|
|
||||||
|
|
@ -147,10 +122,10 @@ index 8e67ae92..da4da5c3 100644
|
||||||
DateTime? lastReceivedPush;
|
DateTime? lastReceivedPush;
|
||||||
|
|
||||||
diff --git a/pubspec.yaml b/pubspec.yaml
|
diff --git a/pubspec.yaml b/pubspec.yaml
|
||||||
index 193e6ed6..f70e48d4 100644
|
index 69c80d6e..efd32d89 100644
|
||||||
--- a/pubspec.yaml
|
--- a/pubspec.yaml
|
||||||
+++ b/pubspec.yaml
|
+++ b/pubspec.yaml
|
||||||
@@ -26,7 +26,7 @@ dependencies:
|
@@ -25,7 +25,7 @@ dependencies:
|
||||||
emoji_picker_flutter: ^2.1.1
|
emoji_picker_flutter: ^2.1.1
|
||||||
emoji_proposal: ^0.0.1
|
emoji_proposal: ^0.0.1
|
||||||
emojis: ^0.9.9
|
emojis: ^0.9.9
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue