Why I am getting this error after Flutter Run? - android

I am getting the following Build failed with exception after I run my flutter project.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.google.android.exoplayer2.ui.DownloadNotificationHelper found in modules jetified-exoplayer-core-2.17.0-runtime (com.google.android.exoplayer:exoplayer-core:2.17.0) and jetified-exoplayer-ui-2.15.1-runtime (com.google.android.exoplayer:exoplayer-ui:2.15.1)
Go to the documentation to learn how to Fix dependency resolution errors.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 26s
Running Gradle task 'assembleDebug'... 208.9s
Exception: Gradle task assembleDebug failed with exit code 1
I am currently using Flutter's latest version that is Version 2.10.1. Also in my project, I used the 'better_player' pub package.
Please give me a solution to this.

Add following dependency in app/build.gradle in dependencies at the end of the file -
implementation 'com.google.android.exoplayer:exoplayer:2.17.0'
Example -
dependencies {
...
implementation 'com.google.android.exoplayer:exoplayer:2.17.0'
}

First : if you are using video_player
add this line in your app/build.gradle
implementation 'com.google.android.exoplayer:exoplayer:2.17.1'
Second : if you are using better_player
add this line in your app/build.gradle
implementation 'com.google.android.exoplayer:exoplayer:2.15.0'
Third : if you are using the both video_player & better_player
you should downgraded video_player version to 2.1.12 in pubspec.yaml

Related

I found this error with gradle on run my flutter app

That is the error when i run my app
i need some help
i add liberary
just_audio:0:9:31
and i found this error and didn't run
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.google.android.exoplayer2.ui.DownloadNotificationHelper found in modules jetified-exoplayer-core-2.18.1-runtime (com.google.android.exoplayer:exoplayer-core:2.18.1) and jetified-exoplayer-ui-2.11.1-runtime (com.google.android.exoplayer:exoplayer-ui:2.11.1)
Duplicate class com.google.android.exoplayer2.ui.package-info found in modules jetified-exoplayer-common-2.18.1-runtime (com.google.android.exoplayer:exoplayer-common:2.18.1) and jetified-exoplayer-ui-2.11.1-runtime (com.google.android.exoplayer:exoplayer-ui:2.11.1)
Go to the documentation to learn how to Fix dependency resolution errors.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1```
i expect to find some advice to solve it
in your android/app/build.gradle, try adding those dependencies:
dependencies {
// ...
def exoplayer_version = "2.18.1" // this is the version
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
implementation "com.google.android.exoplayer:exoplayer-dash:$exoplayer_version"
implementation "com.google.android.exoplayer:exoplayer-hls:$exoplayer_version"
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:$exoplayer_version"
}
save and re build your app.

Error while using flutter background_location package

I just imported the package background_location, and didn't use it. Even though I get this error
* What went wrong:
Execution failed for task ':background_location:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 43s
Exception: Gradle task assembleDebug failed with exit code 1
Tried changing kotlin version, changed minSdkVersion but no change.
Here are a few things you can do:
run flutter clean and flutter pub get and then try again.
go to your android/app/build.gradle and upgrade the Kotlin version. Latest right now is 1.6.0 i.e. ext.kotlin_version = '1.6.0'
Go to android/gradle/wrapper/gradle-wrapper.properties and upgrade distributionURL to distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
This is where I got these solutions from, Flutter: Execution failed for task ':app:compileDebugKotlin'.
Update: Change your dependency in your pubspec.yaml to:
background_location:
git:
url: https://github.com/hilalbaig/background_location.git
ref: master
Here is the reference: https://github.com/Almoullim/background_location/issues/150#issuecomment-1132144094

could not resolve all dependencies for configuration ':classpath' on flutter

hi recently I upgrade and flutter to v2 and my android studio too but after that my flutter app gives a Gradle error and cant be extracted I tried too hard to do many solutions like but maven in dependency but it still gives an error.the gradle version is now 5.6 or something and one more thing all the application running well still which i made before upgrade and its gradle version is
Please help me out and the error is given below.
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':classpath'.
Could not load module metadata from C:\Users\dell.gradle\caches\modules-2\metadata-2.96\descriptors\com.android.tools\annotations\27.1.0\11cd36a7dcab7d14d0c14c5e6c7582e3\descriptor.bin
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 20s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Flutter Android resource linking failed and Failed to apply plugin [id 'kotlin-android']

Opened a project after 2 months, got null-safety error changed some plugins, and upgraded others, one thing led to another and now I am stuck at this error!
Tried Flutter clean and deleting the build and .gradle folder but nothing worked.
Launching lib\main.dart on RMX1801 in debug mode...
lib\main.dart:1
3
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\Dell\.gradle\caches\transforms-2\files-2.1\b94a6b46912fba96397655c3d1ce5de0\play-services-ads-lite-19.6.0\AndroidManifest.xml:27:5-38:15: AAPT: error: unexpected element <queries> found in <manifest>.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 8m 59s
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility.
Building plugin audioplayers...
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.18.2\android\build.gradle' line: 25
* What went wrong:
A problem occurred evaluating root project 'audioplayers'.
> Failed to apply plugin [id 'kotlin-android']
> The current Gradle version 4.10.2 is not compatible with the Kotlin Gradle plugin. Please use Gradle 5.3 or newer, or the previous version of the Kotlin plugin.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 54s
2
Exception: The plugin audioplayers could not be built due to the issue above.
Exited (sigterm)
You're getting a AAPT: error: unexpected element <queries> found in <manifest>. it looks like you have to update your gradle version to one of the ones listed here
https://github.com/miguelpruivo/flutter_file_picker/wiki/Troubleshooting
3.3.3
3.4.3
3.5.4
3.6.4
4.0.1
it looks like you need to downgrade your gradle version since you're using 4.10.2

flutter build error - merging dex archives

I upgraded flutter today (flutter update) and the packages (flutter packages update) and since my app does not build.
This is the output I get (after trying to change the sdk from 27 to 28 and clean)
I would appreciate your help.
Launching lib\main.dart on in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
*********************************************************
WARNING: This version of device_info will break your Android build if it or its dependencies aren't compatible with AndroidX.
See hfor more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\271.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\272.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\273.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\274.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\275.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\276.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\277.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\278.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\279.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\280.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\281.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\282.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\283.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\284.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\285.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\286.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\287.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\288.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\289.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\290.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\291.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\292.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\293.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\294.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\295.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\296.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\297.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\298.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\299.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\300.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\301.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\302.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\303.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\304.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\305.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\306.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\307.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\308.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\309.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\310.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\311.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\312.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\313.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\314.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\315.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\316.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\317.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\318.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\319.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\320.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\321.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\322.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\323.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\324.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\325.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\326.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\327.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\328.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\329.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\330.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\331.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\332.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\333.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\334.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\335.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\336.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\337.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\338.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\339.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\340.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\341.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\342.jar
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 37s
Finished with error: Gradle task assembleDebug failed with exit code 1
Original answer by Yuri Misyac
Enable multidex.
Open {your flutter project}/android/app/build.gradle and add following lines.
defaultConfig {
...
multiDexEnabled true // Add this line
}
and
dependencies {
...
implementation 'com.android.support:multidex:1.0.3' // Add this line
}
Migrate to AndroidX.
Open {your flutter project}/android/gradle.properties and add following lines.
...
android.useAndroidX=true // Add this line
android.enableJetifier=true //Add this line
More info:
Original answer (Check this if it still doesn't work)
Enable Multidex
Migrating to AndroidX

Categories

Resources