Skip to content

Commit dbd4f99

Browse files
authored
Merge pull request #448 from oddbit/copilot/fix-example-app-apk-build
Fix CI Android APK build reliability with Java 17, explicit deps, and clean state
2 parents 71cb2c7 + 396ef9d commit dbd4f99

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

.github/workflows/build_deploy.yml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v4
3636

37+
# Ensure a compatible JDK for modern Android Gradle Plugin
38+
- name: Set up Java 17
39+
if: matrix.platform == 'apk'
40+
uses: actions/setup-java@v4
41+
with:
42+
distribution: temurin
43+
java-version: "17"
44+
3745
- name: Set up Flutter
3846
uses: subosito/flutter-action@v2
3947
with:
@@ -42,7 +50,15 @@ jobs:
4250

4351
- run: flutter --version
4452

45-
- run: flutter pub get
53+
# Resolve root package (plugin) dependencies
54+
- name: Flutter pub get (root)
55+
run: flutter pub get
56+
57+
# Resolve example app dependencies explicitly
58+
- name: Flutter pub get (example)
59+
if: matrix.platform == 'apk'
60+
working-directory: ./example
61+
run: flutter pub get
4662

4763
- name: Configure iOS build environment
4864
if: matrix.platform == 'ios'
@@ -59,19 +75,36 @@ jobs:
5975

6076
- run: flutter doctor
6177

78+
# Start from a clean state to avoid watcher/gradle cache oddities
79+
- name: Flutter clean (example)
80+
if: matrix.platform == 'apk'
81+
working-directory: ./example
82+
run: flutter clean
83+
6284
- name: Build Flutter
6385
working-directory: ./example
6486
run: >-
6587
flutter
6688
build ${{ matrix.platform }}
6789
${{ env.FLUTTER_EXTRA_PARAMS }}
6890
69-
- name: Build iOS IPA with Fastlane
70-
if: matrix.platform == 'ios'
71-
uses: maierj/[email protected]
91+
# Help verify Android outputs and surface them as artifacts
92+
- name: List Android outputs
93+
if: matrix.platform == 'apk'
94+
working-directory: ./example
95+
run: |
96+
echo "Listing build/app/outputs:"
97+
ls -R build/app/outputs || true
98+
99+
- name: Upload APK artifact
100+
if: matrix.platform == 'apk'
101+
uses: actions/upload-artifact@v4
72102
with:
73-
lane: ${{ env.FASTLANE_BUILD_LANE }}
74-
subdirectory: "ios"
103+
name: example-apk
104+
path: |
105+
example/build/app/outputs/flutter-apk/*.apk
106+
example/build/app/outputs/apk/**/*.apk
107+
example/build/**/outputs/**/*.apk
75108
76109
publish:
77110
name: Publish Plugin

0 commit comments

Comments
 (0)