Vivek E
Vivek E

Reputation: 161

Flutter : Several variant outputs are configured to use the same file name

I am just trying to run the first app and this is what happens:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> Several variant outputs are configured to use the same file name "resources-debug.ap_", filters : MAIN:MAIN

Upvotes: 16

Views: 7313

Answers (8)

Muhammad Alif Akbar
Muhammad Alif Akbar

Reputation: 139

It seems like there are several variant outputs that are configured to use the same file name. To resolve this issue, you could try renaming the output files for each variant to avoid conflicts. You can also update the build variant filter configuration to ensure that each variant has a unique output file name.

android {
   ...
   buildTypes {
      debug {
         ...
         applicationVariants.all { variant ->
            variant.outputs.each { output ->
                output.outputFileName = "resources-${variant.name}.ap_"
            }
         }
      }
      release {
        ...
        applicationVariants.all { variant ->
            variant.outputs.each { output ->
                output.outputFileName = "resources-${variant.name}.ap_"
            }
        }
      }
   }
}

Upvotes: 0

Syahreza Fauzi
Syahreza Fauzi

Reputation: 81

  1. remove pubspec.lock
  2. flutter clean
  3. flutter run

Upvotes: 0

Jitendra Mistry
Jitendra Mistry

Reputation: 407

this error also appear when you mistakly disable the app and try to debug same app again.So go to applications and enable it again to resolve the issue.Thanks

Upvotes: 0

Sedzani Ramathaga
Sedzani Ramathaga

Reputation: 26

If flutter clean doesn't work, then delete the Android folder, then run flutter clean and run the app... Make sure you have an android emulator or device connected as your run device, this will bring a prompt asking you to enable android for your project then just click yes.

You can also uninstall the app from your emulator or android device before you run it again, but make sure its uninstalled on all profiles of your device.

Upvotes: 0

David Baruka
David Baruka

Reputation: 151

just log out from current windows session and then do flutter clean and after run your project. that will solve the problem.

Upvotes: 0

mohamed shameem
mohamed shameem

Reputation: 61

  1. Close and reopen IDE
  2. flutter clean
  3. flutter run

Upvotes: 0

Abhijeet Dash
Abhijeet Dash

Reputation: 146

I got the same error while trying to integrate FCM into my application.. The problem is in the older build file.. i.e as we are editing our Manifest file we need to rebuild the project so..

flutter clean
flutter run 

Make sure to do gradle sync if the problem persist.. It solved the problem for me..

Upvotes: 7

Manoj PT
Manoj PT

Reputation: 271

Please try flutter clean and rebuild.

Upvotes: 26

Related Questions