I'm buiding a Flutter Android app with AppCenter build.

I have the following build script taken from here

#!/usr/bin/env bash
#Place this script in project/android/app/
cd ..
# fail if any command fails
set -e
# debug log
set -x
cd ..
git clone -b dev https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter doctor
echo "Installed flutter to `pwd`/flutter"
flutter build apk --release
#copy the APK where AppCenter will find it
mkdir -p android/app/build/outputs/apk/; mv build/app/outputs/apk/release/app-release.apk $_

Here is an excerpt of the build log:

Downloading ios-deploy...                                           0.4s
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel dev, v1.9.7, on Mac OS X 10.14.6 18G87, locale en)
    [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
        ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
    [✓] Xcode - develop for iOS and macOS (Xcode 10.3)
    [!] Android Studio (not installed)
    [!] Connected device
        ! No devices available

    ! Doctor found issues in 3 categories.
    ++ pwd
    + echo 'Installed flutter to /Users/vsts/agent/2.155.1/work/1/s/flutter'
    + flutter build apk --release
    Installed flutter to /Users/vsts/agent/2.155.1/work/1/s/flutter
    Running "flutter pub get" in s...                                   4.1s
    You are building a fat APK that includes binaries for android-arm, android-arm64.
    If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
        To generate an app bundle, run:
            flutter build appbundle --target-platform android-arm,android-arm64
            Learn more on: https://developer.android.com/guide/app-bundle
        To split the APKs per ABI, run:
            flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
            Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
    Initializing gradle...                                          

    Sending crash report to Google.


Looks like AppCenter cannot initialize Gradle. Any suggestions? .gitignore file:

# Android related

Solution 1: mfrischbutter

Is flutter build apk --release working locally? Which build settings you are using in appcenter? Did you updated your .gitignore, like in the tutorial?

Please try to provide some more information. Had a similar problem and solved it by adding the pre-post.sh but it seems you are having a different problem.

Try flutter clean and flutter build. Then try to push and build again.

Solution 2: jasper paardekooper

I was also facing similar issue. An alternative way is just to release an apk to the release section of the appcenter.

Solution 3: Carlos Fernando Arellano Casal

Maybe the non-accepted android licenses are slowing down things.. since you're using some android packages..


flutter doctor --android-licenses

and accept all licenses, then give another try