diff --git a/__brick__/{{app_name}}/android/app/build.gradle b/__brick__/{{app_name}}/android/app/build.gradle index 8a371a3..27bb2b6 100644 --- a/__brick__/{{app_name}}/android/app/build.gradle +++ b/__brick__/{{app_name}}/android/app/build.gradle @@ -1,3 +1,11 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" + id "com.google.gms.google-services" + id "com.google.firebase.crashlytics" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,9 +14,10 @@ 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 keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') @@ -21,31 +30,28 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { // ----- BEGIN flavorDimensions (autogenerated by flutter_flavorizr) ----- - flavorDimensions "flavor-type" + flavorDimensions += "flavor-type" productFlavors { develop { dimension "flavor-type" - applicationIdSuffix ".dev" - resValue "string", "app_name", "{{dispay_name}} Dev" - versionNameSuffix ".dev" + applicationId "{{android_app_id}}.dev" + resValue "string", "app_name", "{{dispay_name}} dev" } prod { dimension "flavor-type" + applicationId "{{android_app_id}}" resValue "string", "app_name", "{{dispay_name}}" } } // ----- END flavorDimensions (autogenerated by flutter_flavorizr) ----- + namespace "{{android_app_id}}" - compileSdkVersion flutter.compileSdkVersion + compileSdk flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { @@ -66,21 +72,20 @@ android { applicationId "{{android_app_id}}" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion + minSdkVersion 26 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName - multiDexEnabled true } signingConfigs { - release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null - storePassword keystoreProperties['storePassword'] - } - } + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } buildTypes { debug { @@ -93,13 +98,12 @@ android { //Other parameters // Enables resource shrinking shrinkResources = true -// zipAlignEnabled true + // zipAlignEnabled true //Enable the proguard proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' ndk { - abiFilters 'armeabi-v7a','arm64-v8a','x86_64' + abiFilters 'arm64-v8a', 'x86_64' } - } } } @@ -109,5 +113,11 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} + // Import the Firebase BoM + implementation platform('com.google.firebase:firebase-bom:32.8.1') + + // TODO: Add the dependencies for Firebase products you want to use + // When using the BoM, don't specify versions in Firebase dependencies + implementation 'com.google.firebase:firebase-analytics-ktx' + implementation 'com.google.firebase:firebase-crashlytics-ktx' +} \ No newline at end of file diff --git a/__brick__/{{app_name}}/android/app/proguard-rules.pro b/__brick__/{{app_name}}/android/app/proguard-rules.pro new file mode 100644 index 0000000..041637e --- /dev/null +++ b/__brick__/{{app_name}}/android/app/proguard-rules.pro @@ -0,0 +1,34 @@ +#Flutter Wrapper +-keep class io.flutter.app.** { *; } +-keep class io.flutter.plugin.** { *; } +-keep class io.flutter.util.** { *; } +-keep class io.flutter.view.** { *; } +-keep class io.flutter.** { *; } +-keep class io.flutter.plugins.** { *; } +#-keep class io.flutter.plugin.editing.** { *; } + +##Firebase +#-keep class com.google.firebase.** { *; } +#-keep class com.firebase.** { *; } +#-keep class org.apache.** { *; } +#-keepnames class com.fasterxml.jackson.** { *; } +#-keepnames class javax.servlet.** { *; } +#-keepnames class org.ietf.jgss.** { *; } +#-dontwarn org.w3c.dom.** +#-dontwarn org.joda.time.** +#-dontwarn org.shaded.apache.** +#-dontwarn org.ietf.jgss.** +#-keepattributes Signature +#-keepattributes *Annotation* +#-keepattributes EnclosingMethod +#-keepattributes InnerClasses +#-keep class androidx.lifecycle.DefaultLifecycleObserver + +#Crashlytics +-keepattributes *Annotation* +# in order to provide the most meaningful crash reports, add the following line: +-keepattributes SourceFile,LineNumberTable +# If you are using custom exceptions, add this line so that custom exception types are skipped during obfuscation: +#-keep public class * extends java.lang.Exception +-keep class com.crashlytics.** { *; } +-dontwarn com.crashlytics.** \ No newline at end of file diff --git a/__brick__/{{app_name}}/android/app/src/develop/AndroidManifest.xml b/__brick__/{{app_name}}/android/app/src/develop/AndroidManifest.xml deleted file mode 100644 index 399f698..0000000 --- a/__brick__/{{app_name}}/android/app/src/develop/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/__brick__/{{app_name}}/android/app/src/prod/AndroidManifest.xml b/__brick__/{{app_name}}/android/app/src/prod/AndroidManifest.xml deleted file mode 100644 index 399f698..0000000 --- a/__brick__/{{app_name}}/android/app/src/prod/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/__brick__/{{app_name}}/android/app/src/profile/AndroidManifest.xml b/__brick__/{{app_name}}/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index 399f698..0000000 --- a/__brick__/{{app_name}}/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/__brick__/{{app_name}}/android/build.gradle b/__brick__/{{app_name}}/android/build.gradle index bf1ce3f..8f31e8c 100644 --- a/__brick__/{{app_name}}/android/build.gradle +++ b/__brick__/{{app_name}}/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.1.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() @@ -28,4 +15,4 @@ subprojects { tasks.register("clean", Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/__brick__/{{app_name}}/android/gradle.properties b/__brick__/{{app_name}}/android/gradle.properties index b9a9a24..dbc33f1 100644 --- a/__brick__/{{app_name}}/android/gradle.properties +++ b/__brick__/{{app_name}}/android/gradle.properties @@ -1,6 +1,6 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G android.useAndroidX=true android.enableJetifier=true android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false -android.nonFinalResIds=false +android.nonFinalResIds=false \ No newline at end of file diff --git a/__brick__/{{app_name}}/android/gradle/wrapper/gradle-wrapper.properties b/__brick__/{{app_name}}/android/gradle/wrapper/gradle-wrapper.properties index 8bc9958..e1ca574 100644 --- a/__brick__/{{app_name}}/android/gradle/wrapper/gradle-wrapper.properties +++ b/__brick__/{{app_name}}/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip diff --git a/__brick__/{{app_name}}/android/settings.gradle b/__brick__/{{app_name}}/android/settings.gradle index 44e62bc..ad3f86d 100644 --- a/__brick__/{{app_name}}/android/settings.gradle +++ b/__brick__/{{app_name}}/android/settings.gradle @@ -1,11 +1,28 @@ -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 + } + settings.ext.flutterSdkPath = flutterSdkPath() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.4.2" apply false + id "org.jetbrains.kotlin.android" version "1.9.20" apply false + id "com.google.gms.google-services" version "4.4.1" apply false + id "com.google.firebase.crashlytics" version "2.9.9" apply false +} + +include ":app" \ No newline at end of file diff --git a/__brick__/{{app_name}}/pubspec.yaml b/__brick__/{{app_name}}/pubspec.yaml index 8771d25..0d471b3 100644 --- a/__brick__/{{app_name}}/pubspec.yaml +++ b/__brick__/{{app_name}}/pubspec.yaml @@ -1,7 +1,7 @@ -name: my_app +name: {{app_name}} description: A new Flutter project. publish_to: 'none' -version: 1.0.0+1 +version: 0.0.1 environment: flutter: '>=3.13.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'