2

When I try to build Android release of my Flutter project, either local or on AppCenter, I receive this error, it can't find the APK built itself! :

...
[        ] BUILD SUCCESSFUL in 3m 51s
[        ] 904 actionable tasks: 903 executed, 1 up-to-date
[ +711 ms] Running Gradle task 'assembleRelease'... (completed in 232.8s, longer than expected)
[  +15 ms] "flutter apk" took 260,152ms.
Gradle build failed to produce an .apk file. It's likely that this file was generated under /Users/runner/runners/2.163.1/work/1/s/build, but the tool couldn't find it.
AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210
  • You can find your answer here: https://stackoverflow.com/questions/51610420/deprecated-gradle-features-were-used-in-this-build-making-it-incompatible-with – Anchal Singh Jan 14 '20 at 06:22

1 Answers1

1

You should check your appcenter-post-clone.sh it should look like this

#!/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 beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH

flutter channel stable
flutter doctor

echo "Installed flutter to `pwd`/flutter"

# build APK
flutter build apk --release

# if you need build bundle (AAB) in addition to your APK, uncomment line below and last line of this script.
#flutter build appbundle

# copy the APK where AppCenter will find it
mkdir -p android/app/build/outputs/apk/; mv build/app/outputs/apk/release/app-release.apk $_

# copy the AAB where AppCenter will find it
mkdir -p android/app/build/outputs/bundle/; mv build/app/outputs/bundle/release/app-release.aab $_ 
SardorbekR
  • 1,388
  • 3
  • 18
  • 33