Skip to content

Commit c0deedd

Browse files
authored
Merge pull request #450 from oddbit/copilot/modernize-android-toolchain-ci
Modernize Android toolchain to AGP 8.5.2, Gradle 8.7, Kotlin 1.9.24, Java 17
2 parents dbd4f99 + ae4a3aa commit c0deedd

File tree

7 files changed

+96
-35
lines changed

7 files changed

+96
-35
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build example app on PR
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build_android_example:
8+
name: Android example build (debug)
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 45
11+
permissions:
12+
contents: read
13+
env:
14+
CI: true
15+
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.vfs.watch=false
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Java 17
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: temurin
24+
java-version: "17"
25+
cache: gradle
26+
27+
- name: Set up Android SDK
28+
uses: android-actions/setup-android@v3
29+
with:
30+
api-level: 34
31+
build-tools: 34.0.0
32+
cache: true
33+
34+
- name: Set up Flutter
35+
uses: subosito/flutter-action@v2
36+
with:
37+
channel: stable
38+
cache: true
39+
40+
- run: flutter --version
41+
42+
- name: Flutter pub get (root)
43+
run: flutter pub get
44+
45+
- name: Flutter pub get (example)
46+
working-directory: example
47+
run: flutter pub get
48+
49+
- name: Flutter clean (example)
50+
working-directory: example
51+
run: flutter clean
52+
53+
- name: Build example APK (debug, verbose)
54+
working-directory: example
55+
run: flutter build apk --debug -v
56+
57+
- name: List Android outputs
58+
working-directory: example
59+
run: |
60+
echo "Listing build/app/outputs:"
61+
ls -R build/app/outputs || true
62+
63+
- name: Upload APK artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: example-app-debug-apk
67+
path: |
68+
example/build/app/outputs/flutter-apk/app-debug.apk
69+
example/build/app/outputs/apk/debug/*.apk
70+
example/build/**/outputs/**/*.apk
71+
if-no-files-found: warn

android/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
.DS_Store
77
/build
88
/captures
9+
gradle-wrapper.jar
10+
gradlew
11+
gradlew.bat

android/build.gradle

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ group = "id.oddbit.flutter.facebook_app_events"
22
version = "1.0-SNAPSHOT"
33

44
buildscript {
5-
ext.kotlin_version = "1.8.22"
5+
ext.kotlin_version = "1.9.24"
66
repositories {
77
google()
88
mavenCentral()
99
}
1010

1111
dependencies {
12-
classpath("com.android.tools.build:gradle:8.1.0")
12+
classpath("com.android.tools.build:gradle:8.5.2")
1313
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
1414
}
1515
}
@@ -26,20 +26,16 @@ apply plugin: "kotlin-android"
2626

2727
android {
2828
namespace "id.oddbit.flutter.facebook_app_events"
29-
// Conditional for compatibility with AGP < 4.2
30-
if (project.android.hasProperty("namespace")) {
31-
namespace "id.oddbit.flutter.facebook_app_events"
32-
}
3329

3430
compileSdk = 34
3531

3632
compileOptions {
37-
sourceCompatibility = JavaVersion.VERSION_1_8
38-
targetCompatibility = JavaVersion.VERSION_1_8
33+
sourceCompatibility = JavaVersion.VERSION_17
34+
targetCompatibility = JavaVersion.VERSION_17
3935
}
4036

4137
kotlinOptions {
42-
jvmTarget = JavaVersion.VERSION_1_8
38+
jvmTarget = "17"
4339
}
4440

4541
sourceSets {
@@ -55,16 +51,7 @@ android {
5551
}
5652

5753
dependencies {
58-
// # READ THIS
59-
// When updating the Facebook SDK. Please note these guidelines to avoid
60-
// conflicts with other plugins that also rely on the FBSDK.
61-
//
62-
// - Only specify the major version of the SDK.
63-
// - Do **not** specify the `minor` or `patch` version.
64-
//
65-
// About the version syntax:
66-
// - https://github.com/oddbit/flutter_facebook_app_events/pull/189#discussion_r768267841
67-
// - https://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm#MAVEN402
54+
// Keep major-only range per repo guidelines.
6855
implementation("com.facebook.android:facebook-android-sdk:[18.0,19.0)")
6956
}
7057
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
zipStoreBase=GRADLE_USER_HOME
4+
zipStorePath=wrapper/dists
5+
# AGP 8.5.x pairs with Gradle 8.7
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

example/android/app/build.gradle

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,16 @@ android {
1111
ndkVersion = flutter.ndkVersion
1212

1313
compileOptions {
14-
sourceCompatibility = JavaVersion.VERSION_1_8
15-
targetCompatibility = JavaVersion.VERSION_1_8
14+
sourceCompatibility = JavaVersion.VERSION_17
15+
targetCompatibility = JavaVersion.VERSION_17
1616
}
1717

1818
kotlinOptions {
19-
jvmTarget = JavaVersion.VERSION_1_8
19+
jvmTarget = "17"
2020
}
2121

2222
defaultConfig {
23-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
2423
applicationId = "id.oddbit.flutter.facebook_app_events_example"
25-
// You can update the following values to match your application needs.
26-
// For more information, see: https://flutter.dev/to/review-gradle-config.
2724
minSdk = flutter.minSdkVersion
2825
targetSdk = flutter.targetSdkVersion
2926
versionCode = flutter.versionCode
@@ -41,8 +38,7 @@ android {
4138

4239
buildTypes {
4340
release {
44-
// TODO: Add your own signing config for the release build.
45-
// Signing with the debug keys for now, so `flutter run --release` works.
41+
// Signing with the debug keys for sample reproducibility.
4642
signingConfig = signingConfigs.debug
4743
}
4844
}

example/android/build.gradle

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ buildscript {
77
}
88

99
dependencies {
10-
// Updated Android Gradle Plugin to meet Flutter's minimum supported version.
11-
// Was: 'com.android.tools.build:gradle:8.1.0'
12-
classpath 'com.android.tools.build:gradle:8.1.1'
13-
14-
// NOTE: Do not place your application dependencies here; they belong
15-
// in the individual module build.gradle files
10+
// Modern Android Gradle Plugin
11+
classpath 'com.android.tools.build:gradle:8.5.2'
12+
// Modern Kotlin
13+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24"
1614
}
1715
}
1816

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
# Use Gradle 8.3 which is compatible with Android Gradle Plugin 8.1.1
7-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
6+
# AGP 8.5.x pairs with Gradle 8.7
7+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

0 commit comments

Comments
 (0)