Skip to content

Commit 01ee3a9

Browse files
committed
update some gradle properties for android build
1 parent 92ca1ab commit 01ee3a9

File tree

4 files changed

+33
-45
lines changed

4 files changed

+33
-45
lines changed

simple_sample/android/app/build.gradle

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
6+
}
7+
18
def localProperties = new Properties()
29
def localPropertiesFile = rootProject.file('local.properties')
310
if (localPropertiesFile.exists()) {
@@ -6,11 +13,6 @@ if (localPropertiesFile.exists()) {
613
}
714
}
815

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1416
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1517
if (flutterVersionCode == null) {
1618
flutterVersionCode = '1'
@@ -21,11 +23,6 @@ if (flutterVersionName == null) {
2123
flutterVersionName = '1.0'
2224
}
2325

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'com.google.gms.google-services'
26-
apply plugin: 'kotlin-android'
27-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
28-
2926
android {
3027
compileSdkVersion 30
3128

@@ -36,7 +33,7 @@ android {
3633
defaultConfig {
3734
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3835
applicationId "com.example.simple_sample"
39-
minSdkVersion 20 //modified
36+
minSdkVersion flutter.minSdkVersion //modified
4037
targetSdkVersion 30
4138
versionCode flutterVersionCode.toInteger()
4239
versionName flutterVersionName
@@ -58,9 +55,7 @@ flutter {
5855
}
5956

6057
dependencies {
61-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
6258
implementation 'androidx.multidex:multidex: 2.0.1'
63-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
6459
implementation 'com.google.firebase:firebase-messaging:20.1.0'
6560
implementation 'com.google.firebase:firebase-analytics:17.2.2'
66-
}
61+
}

simple_sample/android/build.gradle

+1-22
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
buildscript {
2-
ext.kotlin_version = '1.4.32'
3-
repositories {
4-
google()
5-
jcenter()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.1.0'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
classpath 'com.google.gms:google-services:4.3.8'
12-
13-
// Import the BoM for the Firebase platform
14-
//implementation platform('com.google.firebase:firebase-bom:28.1.0') //todo problema
15-
16-
// Declare the dependency for the Cloud Storage library
17-
// When using the BoM, you don't specify versions in Firebase library dependencies
18-
//implementation 'com.google.firebase:firebase-storage'
19-
}
20-
}
21-
221
allprojects {
232
repositories {
243
google()
@@ -34,6 +13,6 @@ subprojects {
3413
project.evaluationDependsOn(':app')
3514
}
3615

37-
task clean(type: Delete) {
16+
tasks.register("clean", Delete) {
3817
delete rootProject.buildDir
3918
}

simple_sample/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
6+
distributionUrl=https://services.gradle.org/distributions/gradle-7.6.1-all.zip

simple_sample/android/settings.gradle

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "7.2.0" apply false
22+
id "org.jetbrains.kotlin.android" version "1.7.20" apply false
23+
}
24+
25+
include ":app"

0 commit comments

Comments
 (0)