Repository navigation
Gradle build failed to produce an .apk file #45346
Copy link
Copy link
Closed
Description
Error Message
Gradle build failed to produce an .apk file. It's likely that this file was generated under C:\Users\...\build, but the tool couldn't find it.
Issue
I've tried moving my Flutter app to AndroidX after it kept prompting me but after doing so the above error message keeps appearing and now I can't even run my app. Any assistance on what can be done for this?
Tried
- Flutter clean
- New emulator
- Disabling AndroidX (doesn't work)
Flutter Doctor --verbose
[√] Flutter (Channel master, v1.12.6-pre.15, on Microsoft Windows [Version 10.0.18363.476], locale en-GB)
• Flutter version 1.12.6-pre.15 at C:\Android\flutter
• Framework revision 43a8a1902e (5 hours ago), 2019-11-21 12:09:43 +0100
• Engine revision 7a77e3625d
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Android\
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = C:\Android
• ANDROID_SDK_ROOT = C:\Android\sdk
• Java binary at: C:\Android\openjdk\bin\java
• Java version OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_202-b08)
• All Android licenses accepted.
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/setup/#android-setup for detailed instructions).
[√] VS Code (version 1.40.1)
• VS Code at C:\Users\tvalois\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.6.0
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
Full Issue
The plugin "cloud_firestore" is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment. It may have undefined behaviors when Flutter is integrated into an existing app as a module.
The plugin can be updated to the v2 Android Plugin APIs by following
https://flutter.dev/go/android-plugin-migration.
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Note: C:\Android\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.10+2\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Android\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.10+2\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Android\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_analytics-5.0.6\android\src\main\java\io\flutter\plugins\firebaseanalytics\FirebaseAnalyticsPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Android\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.1+5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java uses or overrides a deprecated API.
Gradle build failed to produce an .apk file. It's likely that this file was generated under C:\Users\...\build, but the tool couldn't find it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
iapicca commentedon Nov 22, 2019
Hi @ThomasValois
the error seems caused by the
cloud_firestoreFlutterFire plugin,please open the issue in the dedicated github.
Closing, as this isn't an issue with Flutter itself,
if you disagree please write in the comments and I will reopen it
thank you
DyaryRaoof commentedon Dec 5, 2019
Having the same issue on android , I am only using
firebase_messagingplugin notcloud_firestoremigalv commentedon Dec 27, 2019
Same issue here. I'm just trying to run on profile mode, but it throws this error:
It also takes ages to build for some reason :/
I don't think it has anything to do with the cloud_firestore, because those are just Xlint warnings.
I never had this issue, I believe it could be related to the upgrade to Flutter v1.12, I updated recently
SOLVED
I solved my problem. This was caused because I was not entering the --flavor argument.
Maybe it can be yours too, check if you have flavors activated.
Maybe more information about this error in the future?
mobile-dualbootpartners commentedon Jan 16, 2020
I had the same problem on the Mac and solution for was add to
android/app/build.gradle:bangonkali commentedon Jan 20, 2020
This worked for me. I have been looking around for the solution to this problem for quite a while now. Thanks!
iapicca commentedon Feb 5, 2020
Could everyone who still has this problem please file a new issue with the exact descriptions what happens, logs and the output of 'flutter doctor -v' please.
All system setups can be slightly different so it's always better to open new issues and reference related issues.
superyyl commentedon Mar 31, 2020
I solved this problem.
To run
flutter clean, will clean the build folder.lock commentedon Apr 15, 2020
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.