Skip to content

Commit e62c485

Browse files
Demo app gradle migrated
1 parent f8737e6 commit e62c485

File tree

4 files changed

+45
-50
lines changed

4 files changed

+45
-50
lines changed

android/build.gradle

-21
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,6 @@ if (version_name != null) {
1212
rootProject.ext.version_name = 'debugVersion'
1313
}
1414

15-
16-
// buildscript {
17-
18-
// def version_name = System.getenv('TRAVIS_TAG')
19-
// if (version_name != null) {
20-
// rootProject.ext.version_name = version_name
21-
// } else {
22-
// rootProject.ext.version_name = 'debugVersion'
23-
// }
24-
25-
// repositories {
26-
// google()
27-
// mavenCentral()
28-
// }
29-
30-
// dependencies {
31-
// classpath 'com.android.tools.build:gradle:7.2.1'
32-
// }
33-
// }
34-
3515
configurations {
3616
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
3717
}
@@ -83,7 +63,6 @@ android {
8363

8464
}
8565

86-
8766
dependencies {
8867
implementation 'androidx.multidex:multidex:2.0.0'
8968
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

example/android/app/build.gradle

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
plugins {
3+
id "com.android.application"
4+
id "org.jetbrains.kotlin.android"
5+
id "dev.flutter.flutter-gradle-plugin"
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,10 +23,6 @@ if (flutterVersionName == null) {
2123
flutterVersionName = '1.0'
2224
}
2325

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2826
android {
2927
compileSdkVersion 32
3028
ndkVersion flutter.ndkVersion
@@ -43,6 +41,7 @@ android {
4341
targetSdkVersion 32
4442
versionCode flutterVersionCode.toInteger()
4543
versionName flutterVersionName
44+
// manifestPlaceholders = [applicationName: "android.app.Application"]
4645
}
4746

4847
buildTypes {
@@ -57,3 +56,7 @@ android {
5756
flutter {
5857
source '../..'
5958
}
59+
60+
dependencies {
61+
implementation 'com.android.support:multidex:1.0.3'
62+
}

example/android/build.gradle

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
buildscript {
2-
ext.kotlin_version = '1.6.10'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
71

8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.2.1'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
132
ext {
143
android_sdk_version = "4.0.0"
154
}
5+
166
allprojects {
177
repositories {
188
google()
@@ -28,6 +18,6 @@ subprojects {
2818
project.evaluationDependsOn(':app')
2919
}
3020

31-
task clean(type: Delete) {
21+
tasks.register("clean", Delete) {
3222
delete rootProject.buildDir
3323
}

example/android/settings.gradle

+31-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
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+
}
9+
10+
settings.ext.flutterSdkPath = flutterSdkPath()
11+
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
212

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
13+
repositories {
14+
google()
15+
mavenCentral()
16+
gradlePluginPortal()
17+
}
18+
resolutionStrategy {
19+
eachPlugin {
20+
if (requested.id.namespace == 'dev.flutter') {
21+
useModule("dev.flutter:${requested.id.name}:${requested.version}")
22+
}
23+
}
24+
}
25+
}
526

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
27+
plugins {
28+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
29+
id "com.android.application" version "7.2.1" apply false
30+
id "org.jetbrains.kotlin.android" version "1.6.10" apply false
31+
}
32+
33+
include ":app"
834

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"

0 commit comments

Comments
 (0)