Skip to content

Commit 59d7f69

Browse files
authored
chore: fixed Android example app build for CI/CD (#1985)
1 parent d73d2f1 commit 59d7f69

File tree

9 files changed

+38
-75
lines changed

9 files changed

+38
-75
lines changed

example/android/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gradle-wrapper.jar
77
GeneratedPluginRegistrant.java
88

99
# Remember to never publicly share your keystore.
10-
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
10+
# See https://flutter.dev/to/reference-keystore
1111
key.properties
1212
**/*.keystore
1313
**/*.jks

example/android/app/build.gradle

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,40 @@
11
plugins {
22
id "com.android.application"
33
id "kotlin-android"
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
45
id "dev.flutter.flutter-gradle-plugin"
56
}
67

7-
def localProperties = new Properties()
8-
def localPropertiesFile = rootProject.file('local.properties')
9-
if (localPropertiesFile.exists()) {
10-
localPropertiesFile.withReader('UTF-8') { reader ->
11-
localProperties.load(reader)
12-
}
13-
}
14-
15-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
16-
if (flutterVersionCode == null) {
17-
flutterVersionCode = '7'
18-
}
19-
20-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
21-
if (flutterVersionName == null) {
22-
flutterVersionName = '7.0.1'
23-
}
24-
258
android {
26-
namespace "dev.fleaflet.flutter_map.example"
27-
compileSdk flutter.compileSdkVersion
28-
ndkVersion flutter.ndkVersion
9+
namespace = "dev.fleaflet.flutter_map.example"
10+
compileSdk = flutter.compileSdkVersion
11+
// ndkVersion = flutter.ndkVersion
12+
ndkVersion = "26.1.10909125"
2913

3014
compileOptions {
31-
sourceCompatibility JavaVersion.VERSION_1_8
32-
targetCompatibility JavaVersion.VERSION_1_8
15+
sourceCompatibility = JavaVersion.VERSION_1_8
16+
targetCompatibility = JavaVersion.VERSION_1_8
3317
}
3418

3519
kotlinOptions {
36-
jvmTarget = '1.8'
37-
}
38-
39-
sourceSets {
40-
main.java.srcDirs += 'src/main/kotlin'
20+
jvmTarget = JavaVersion.VERSION_1_8
4121
}
4222

4323
defaultConfig {
44-
applicationId "dev.fleaflet.flutter_map.example"
45-
minSdkVersion flutter.minSdkVersion
46-
targetSdkVersion 34
47-
versionCode flutterVersionCode.toInteger()
48-
versionName flutterVersionName
24+
applicationId = "dev.fleaflet.flutter_map.example"
25+
minSdk = flutter.minSdkVersion
26+
targetSdk = flutter.targetSdkVersion
27+
versionCode = flutter.versionCode
28+
versionName = flutter.versionName
4929
}
5030

5131
buildTypes {
5232
release {
53-
// TODO: Add your own signing config for the release build.
54-
// Signing with the debug keys for now, so `flutter run --release` works.
55-
signingConfig signingConfigs.debug
33+
signingConfig = signingConfigs.debug
5634
}
5735
}
5836
}
5937

6038
flutter {
61-
source '../..'
39+
source = "../.."
6240
}
63-
64-
dependencies {}
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2-
<!-- The INTERNET permission is required for development. Specifically,
3-
the Flutter tool needs it to communicate with the running application
4-
to allow setting breakpoints, to provide hot reload, etc.
5-
-->
62
<uses-permission android:name="android.permission.INTERNET"/>
73
</manifest>

example/android/app/src/main/AndroidManifest.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2-
<!-- Requried for fetching tiles -->
32
<uses-permission android:name="android.permission.INTERNET"/>
43
<application
54
android:label="flutter_map Demo"
@@ -9,6 +8,7 @@
98
android:name=".MainActivity"
109
android:exported="true"
1110
android:launchMode="singleTop"
11+
android:taskAffinity=""
1212
android:theme="@style/LaunchTheme"
1313
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1414
android:hardwareAccelerated="true"
@@ -32,4 +32,15 @@
3232
android:name="flutterEmbedding"
3333
android:value="2" />
3434
</application>
35+
<!-- Required to query activities that can process text, see:
36+
https://developer.android.com/training/package-visibility and
37+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
38+
39+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
40+
<queries>
41+
<intent>
42+
<action android:name="android.intent.action.PROCESS_TEXT"/>
43+
<data android:mimeType="text/plain"/>
44+
</intent>
45+
</queries>
3546
</manifest>
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2-
<!-- The INTERNET permission is required for development. Specifically,
3-
the Flutter tool needs it to communicate with the running application
4-
to allow setting breakpoints, to provide hot reload, etc.
5-
-->
62
<uses-permission android:name="android.permission.INTERNET"/>
73
</manifest>

example/android/build.gradle

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,18 @@
1-
buildscript {
2-
ext.kotlin_version = '1.8.21'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
// AGP version is set in settings.gradle.
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()
174
mavenCentral()
185
}
196
}
207

21-
rootProject.buildDir = '../build'
8+
rootProject.buildDir = "../build"
9+
2210
subprojects {
2311
project.buildDir = "${rootProject.buildDir}/${project.name}"
24-
}
25-
subprojects {
26-
project.evaluationDependsOn(':app')
12+
project.evaluationDependsOn(":app")
2713
}
2814

2915
tasks.register("clean", Delete) {
3016
delete rootProject.buildDir
3117
}
18+

example/android/gradle.properties

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
org.gradle.jvmargs=-Xmx4G
1+
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
22
android.useAndroidX=true
33
android.enableJetifier=true
4-
android.defaults.buildfeatures.buildconfig=true
5-
android.nonTransitiveRClass=false
6-
android.nonFinalResIds=false

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip

example/android/settings.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ pluginManagement {
55
def flutterSdkPath = properties.getProperty("flutter.sdk")
66
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
77
return flutterSdkPath
8-
}
9-
settings.ext.flutterSdkPath = flutterSdkPath()
8+
}()
109

11-
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
1211

1312
repositories {
1413
google()
@@ -19,7 +18,8 @@ pluginManagement {
1918

2019
plugins {
2120
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
22-
id "com.android.application" version '8.2.0' apply false
21+
id "com.android.application" version '8.5.2' apply false
22+
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
2323
}
2424

2525
include ":app"

0 commit comments

Comments
 (0)