I’m facing an issue with my Flutter Android build on CircleCI where it fails with the following error:
Execution failed for task ':app:androidDependencies'.
> Could not resolve all artifacts for configuration ':app:prodDebugCompileClasspath'.
> Could not find com.google.android:flexbox:2.0.1.
Required by:
project :app
Here’s the relevant part of my android/app/build.gradle
:
android {
...
flavorDimensions "default"
productFlavors {
staging {
dimension "default"
applicationIdSuffix ".staging"
manifestPlaceholders = [appName: "App Staging", isStaging: true, isProduction: false]
}
prod {
dimension "default"
applicationIdSuffix ""
manifestPlaceholders = [appName: "App", isStaging: false, isProduction: true]
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.0"
implementation 'com.google.firebase:firebase-messaging:21.0.0'
implementation 'com.polidea.rxandroidble2:rxandroidble:1.11.1'
implementation "com.google.android.material:material:1.5.0"
implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android:flexbox:2.0.1' // added this to implementation
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
}
and I’ve also tried to add a combination on these in android/build.gradle
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
jcenter() // Note: jcenter is deprecated but can still be used for legacy dependencies
}
}
Where I’ve added mavenCentral()
and maven { url 'https://maven.google.com' }
but nothing works there.
Context:
- I am using a Zoom SDK bridge in my Flutter app. (version 5.16.6)
- The error occurs during the CircleCI build process but not on local builds.
- Running
./gradlew clean build --refresh-dependencies
doesn’t seem to work.
my CircleCI config:
version: "2.1"
orbs:
flutter: circleci/[email protected]
android: circleci/[email protected]
macos: circleci/[email protected]
parameters:
manual-staging-run:
type: boolean
default: false
workflows:
build:
jobs:
- lint_and_test:
filters:
branches:
ignore:
- staging
- main
deploy_staging:
jobs:
- lint_and_test:
filters:
branches:
only: staging
- deploy_staging_ios:
requires:
- lint_and_test
- deploy_staging_android:
requires:
- lint_and_test
deploy_prod:
jobs:
- lint_and_test:
filters:
branches:
only: main
- deploy_prod_ios:
requires:
- lint_and_test
- deploy_prod_android:
requires:
- lint_and_test
manual_deploy_staging:
when: << pipeline.parameters.manual-staging-run >>
jobs:
- lint_and_test
- deploy_staging_ios:
requires:
- lint_and_test
- deploy_staging_android:
requires:
- lint_and_test
commands:
setup_env:
steps:
- checkout
- flutter/install_sdk_and_pub:
version: 3.19.5
- run:
name: Install Zoom SDK
command: flutter pub run zoom:unzip_zoom_sdk
run_fastlane:
parameters:
fastlane_lane:
default: "staging_release"
type: string
platform:
default: ""
type: string
steps:
- run:
no_output_timeout: 50m
name: Fastlane
command: bundle exec fastlane <<parameters.fastlane_lane>> build_number:$CIRCLE_BUILD_NUM
working_directory: <<parameters.platform>>
build_ios:
parameters:
fastlane_lane:
default: "staging_release"
type: string
output_dir:
default: output
type: string
steps:
- setup_env
- flutter/install_ios_pod
- flutter/install_ios_gem:
cache-version: v1.1
- run: echo "$APP_STORE_API_KEY_JSON" | base64 --decode > ios/key_file.json
- run_fastlane:
fastlane_lane: <<parameters.fastlane_lane>>
platform: ios
- store_artifacts:
path: <<parameters.output_dir>>
destination: outputs
build_android:
parameters:
flavor:
default: staging
type: string
output_dir:
default: output
type: string
steps:
- setup_env
- flutter/install_android_gradle_dependencies
- flutter/install_android_gem
- run: echo "$PLAY_STORE_UPLOAD_KEY" | base64 --decode > android/app-keystore
- run: echo "$PLAY_STORE_UPLOAD_KEY_INFO" | base64 --decode > android/key.properties
- run: echo "$SUPPLY_JSON_KEY_DATA" > android/play-store-credentials.json
- run_fastlane:
fastlane_lane: <<parameters.flavor>>_release
platform: android
# - run_fastlane:
# fastlane_lane: <<parameters.flavor>>_apk
# platform: android
- store_artifacts:
path: <<parameters.output_dir>>
destination: outputs
jobs:
deploy_staging_android:
description: Deploy Staging build to internal testers in Play Store
executor:
name: android/android-machine
tag: 2024.01.1
steps:
- build_android:
flavor: staging
output_dir: android/build/app/outputs/flutter-apk/app-staging-release.apk
deploy_prod_android:
description: Deploy Prod build to internal testers in Play Store
executor:
name: android/android-machine
tag: 2024.01.1
steps:
- build_android:
flavor: prod
output_dir: android/build/app/outputs/flutter-apk/app-prod-release.apk
deploy_staging_ios:
description: Deploy Staging build to TestFlight
macos:
xcode: 15.3.0
resource_class: macos.m1.medium.gen1
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- run: brew install graphicsmagick
- run:
command: |
#!/usr/bin/env bash
if [ "$(uname -m)" = "arm64" ]; then
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
else
echo "Rosetta 2 can only be installed on Apple Silicon!"
exit 1
fi
name: Installing Rosetta 2
- build_ios:
fastlane_lane: staging_release
deploy_prod_ios:
description: Deploy Prod build to TestFlight
macos:
xcode: 15.3.0
resource_class: macos.m1.medium.gen1
steps:
- run:
command: |
#!/usr/bin/env bash
if [ "$(uname -m)" = "arm64" ]; then
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
else
echo "Rosetta 2 can only be installed on Apple Silicon!"
exit 1
fi
- build_ios:
fastlane_lane: pre_release
lint_and_test:
description: Run flutter analyze and Unit Tests
docker:
- image: "ghcr.io/cirruslabs/flutter:3.19.5"
steps:
- checkout
- flutter/install_pub
- run: echo 'export PATH="$PATH":"$HOME/.pub-cache/bin"' >> $BASH_ENV
- run:
name: Install junitreport
shell: "/bin/bash --login -eo pipefail"
command: dart pub global activate junitreport
- run: mkdir test-results
- run:
name: Run flutter analysis
command: flutter analyze
- run:
name: Run Unit Test
command: flutter test --machine | tojunit -o test-results/unit-test-report.xml
- store_test_results:
path: test-results
How can I resolve the Could not find com.google.android:flexbox:2.0.1
error in my CircleCI build process? Are there any additional steps I should take to ensure that the dependencies are correctly resolved in the CI environment?