Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle build failed to produce an .apk file #45346

Closed
ThomasValois opened this issue Nov 21, 2019 · 8 comments
Closed

Gradle build failed to produce an .apk file #45346

ThomasValois opened this issue Nov 21, 2019 · 8 comments

Comments

@ThomasValois
Copy link

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.
@iapicca
Copy link
Contributor

iapicca commented Nov 22, 2019

Hi @ThomasValois
the error seems caused by the cloud_firestore FlutterFire 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

@iapicca iapicca closed this as completed Nov 22, 2019
@DyaryRaoof
Copy link

DyaryRaoof commented Dec 5, 2019

Having the same issue on android , I am only using firebase_messaging plugin not cloud_firestore

@migalv
Copy link

migalv commented Dec 27, 2019

Same issue here. I'm just trying to run on profile mode, but it throws this error:

Running Gradle task 'assembleProfile'... Done                     597,5s (!)
Gradle build failed to produce an .apk file. It's likely that this file was generated under ...

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

I had the same problem on the Mac and solution for was add to android/app/build.gradle:

android {
     ... // Your android config

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

@bangonkali
Copy link

I had the same problem on the Mac and solution for was add to android/app/build.gradle:

android {
     ... // Your android config

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

This worked for me. I have been looking around for the solution to this problem for quite a while now. Thanks!

@iapicca
Copy link
Contributor

iapicca commented 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
Copy link

I solved this problem.
To run flutter clean, will clean the build folder.

@lock
Copy link

lock bot commented 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 -v and a minimal reproduction of the issue.

@lock lock bot locked and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants