Flutter - android - Execution failed for task ':app:checkDebugDuplicateClasses' - android

I am not able to use
flutter_html: ^2.2.1
and
audio_manager: ^0.8.2
in one project.
It shows error
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.package-info found in modules jetified-exoplayer-common-2.14.1-runtime (com.google.android.exoplayer:exoplayer-common:2.14.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.

Clean the project: flutter clean
Upgrade dependencies: flutter pub upgrade --major-versions
Run the app. Let me know if you still had problem using those packages.
Update:
this seems to be a problem with audio_manager. try using audio_service: ^0.18.3 instead. audio_service

You need to override the version of exoplayer in the grade file

Related

Flutter Android build not generating in Mac

In Mac, I've setup Flutter in Android studio. When I'm running project it gives me error
* What went wrong:
Execution failed for task ':location:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
I'm using all latest versions of Flutter, Kotlin, Gradle etc.
You need to equalize kotlin version in first row which is ext.kotlin_version = '1.6.10' to according to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" of underlined $kotlin_version
After this, the problem will solve...
Actually I found a solution for my problem. There are 2 dependency defined in .yaml file 1. geo_location and 2. location.
After removing the location dependency from .yaml file and run command flutter pub get I can successfully build android build from Mac. This solution might not be global but solution of my problem I found this.
Thank you!
Happy coding.

Task :app:bundleReleaseJsAndAssets FAILED - React Native - Android

Getting this error in my React-Native app when I run on Android using npx react-native run-android --variant=release or generate a Release Build. I tried whatever solutions I found on Stackoverflow and GitHub like - upgrading gradle build tools version, modifying babel.config.js, clean project, --reset-cache, rm -rf node_modules and reinstall, Invalidate and Restart, etc. but none of it solved. It is a blocker since I am not able to generate a build to publish.
I have provided the only stacktrace error available.
> Task :app:bundleReleaseJsAndAssets FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 5 executed
The system cannot find the path specified.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1
Another information I noticed is I am getting the above stacktrace when the build execution executes :app:bundleReleaseJsAndAssets and reaches react-native-animated. I tried the solutions suggested from the similar issues reported in react-native-animated but that too didn't fix.
I am not able to find whether the issue is with the package or the local project setup.
Also I noticed that the package doesn't seem to be configured properly in Android. Screenshot attached below for reference. This package alone doesn't have the right arrow.
Library versions:
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-reanimated": "2.1.0"
Gradle info:
classpath("com.android.tools.build:gradle:4.0.1")
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip
Android Studio Version: 4.2.1
Any Suggestions?
While checking this answer I found that the below line was present in my code
project.ext.react = [
nodeExecutableAndArgs : ["/usr/local/bin/node"]
];
My other RN projects doesn't have this line but worked fine. So removing the line nodeExecutableAndArgs : ["/usr/local/bin/node"] fixed the issue.
I was getting a similar issue. After struggling with it for a few hours, realised it was due to babel.
Upgrading babel to latest version helped me resolve this issue.
Hope this helps someone.

KtLint Execution failed for task ':app:ktlintAndroidTestDebugSourceSetCheck'

I am using gradle version 7.0.0-beta01 and following this guide to setup KtLint to my project. But I am facing error while running following command
./gradlew ktlintFormat
Running with -stacktrace etc also doesn't seem to help much. Here is the error I am getting. Any help is much appreciated.
Execution failed for task ':app:ktlintAndroidTestDebugSourceSetFormat'.
> Querying the mapped value of task ':app:ktlintAndroidTestDebugSourceSetFormat' property 'reporterOutputDir' before task ':app:ktlintAndroidTestDebugSourceSetFormat' has completed is not supported
This was fixed in a later version of the ktlint gradle plugin. You can go down to 9.2.1 or up to 10.0.0. See this issue.

Flutter issue: 'ChipsInputState' is missing

I'm currently learning Flutter using Android Studio but I can't figure this issue help pls thank you :(
Compiler message:
../../.pub-cache/hosted/pub.dartlang.org/flutter_chips_input-1.3.1/lib/src/chips_input.dart:42:7:
Error: The non-abstract class 'ChipsInputState' is missing
implementations for these members:
- TextInputClient.connectionClosed Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class ChipsInputState extends State>
^^^^^^^^^^^^^^^ ../../flutter/packages/flutter/lib/src/services/text_input.dart:658:8:
Context: 'TextInputClient.connectionClosed' is defined here. void
connectionClosed();
^^^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed.
FAILURE: Build failed with an exception.
Where: Script '/Users/clyde/flutter/packages/flutter_tools/gradle/flutter.gradle'
line: 780
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/Users/clyde/flutter/bin/flutter'' finished with non-zero exit value 1
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 18s Finished with error: Gradle task assembleDebug
failed with exit code 1
If you are using Flutter Form Builder, you can manually update the flutter_chips_input library to the latest version because the Flutter form builder uses an old version.
This issue was discussed in the Flutter GitHub repository Issues section here.
Adding the below dependency manually to the pubspec.yaml file solved the problem for me:
flutter_chips_input: ^1.9.4
I am guessing you are on dev or master channel (at least that is the cause in my case)...you can switch to beta or stable to get rid of the error:
flutter channel beta|stable
I have also faced the same problem and not sure how that was fixed.
I have tried the following things
Check Flutter Doctor and fix if you have any errors
Try Flutter clean
Delete pubspec.lock file and run flutter pub get or flutter pub upgrade
I Hope, that may help you guys.
What worked for me
Look for packages in your pubspec.yaml file that depend on the chips_input package, e.g. form_builder and make sure it's the latest version.
Upgrade all packages in pubspec.yaml file to be sure.
I've been stack with the same error. I've searched and tried everything and nothing works.
Based on searching, the issues may have been caused by using flutter_form_builder package on an incompatible version of flutter SDK.
What works for me (Windows user):
Tried switching to master|stable version
Deleted all flutter and pub temp directories/folders:
Navigate to C:/Users/(Current User)/AppData/Local/Temp/ and delete all directories/folders having
flutter_tool.xxx, native-platformxxx, and pubxxx
Installed the latest version of Flutter SDK.
https://storage.googleapis.com/flutter_infra/releases/stable/windows/flutter_windows_1.17.3-stable.zip
Tried Flutter clean
Deleted pubspec.lock file and run flutter pub get or flutter pub upgrade
Upon building my project, another issue pop-up, NDK version not found. Instead of downloading the required NDK, I removed/renamed the NDK directory/folder from my Android SDK directory/folder.
Hope this steps helps.

How to fix flutter AndroidX incompatibility?

I just import webview_flutter plugin and found that the plugin has incompatible with my flutter environment. Then using Android Studio I migrate my AndroidX environment with "Migrate to AndroidX" option.
I want to use webview_flutter plugin for viewing the page. Help appreciated.
Here is the error message
Launching lib/main.dart on Andromax B26D2H in debug mode...
D8: Program type already present: android.support.v4.media.MediaBrowserCompat$ItemCallback
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: /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/105.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/148.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/133.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/72.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/128.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/79.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/88.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/110.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/67.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/120.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/91.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/102.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/118.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/5.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/52.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/58.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/127.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/142.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/151.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/46.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/63.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/107.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/115.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/70.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/62.jar,
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.media.MediaBrowserCompat$ItemCallback
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 4m 59s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility for more information on the problem and how to fix it.
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Thanks for your suggestion,
I've fixed it by doing these steps :
1. Try adding this line In your Project folder > android > app > build.gradle, add the following Line in
multiDexEnabled true
inside defaultConfig
Then upgrade gradle dependency in the android/build.gradle file: classpath 'com.android.tools.build:gradle:3.3.1' (previously on version 3.2.1)
Run flutter clean and rebuild your project
First make sure that all your packages in the pubspec.yaml are of the latest version. Then open the android project of your flutter app with android studio, select Refactor->Migrate to Androidx(make sure that you are doing that that from the android project and not from the flutter one). Wait until android studio finishes migrating your project, rebuild your project. Hope it helps!
I found this solution on Github by #tiklupxgit, solved this issue quickly.
Update this line in [Project Directory]/android/build.gradle
classpath 'com.android.tools.build:gradle:3.5.4'
Now run these commands in your terminal under [Project Directory]
flutter clean && flutter pub get
Finally, build your project again.
It seems like you are facing issues with dex and androidX.
Follow https://stackoverflow.com/a/56490440/9236994
this answer to resolve your issue.
Create a new flutter project and move existing code to it: flutter migration
flutter create --androidx -t <project-type> <new-project-path>
eg: flutter create --androidx -t app .
I have tried the best ever possible ways to break it down. I have been trying to use youtube videos from URL using the youtube video flutter plugin and getting androidx incompatibilities plugin error. Finally, I found the result. Just update
the build.Gradle file in android - classpath
'com.android.tools.build:gradle:4.1.0'
gradle-wrapper.properties
distributionUrl=https://services.Gradle.org/distributions/gradle-6.7-all.zip
update the value as above it will work perfect, as for me.
For me, I copied settings.gradle file
to the new file settings_aar.gradle
Then Removed the following code from settings_aar.gradle:
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
Ok I finally solved the problem thanks to #Navpreet Singh
In order to fix the problem of the default grey icon of Firebase FCM (on Xiaomi devices) I added in the Manifest:
From then on, I got this error when building the application:
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Completed 20,2s
The build failed probably because of AndroidX incompatibilities in a plugin. The tool is about to
try to use Jetifier to resolve the incompatibility.
Building the cloud_firestore plugin...
Exception: The cloud_firestore plugin could not be built because of the above problem.
Running the Gradle task 'assembleAarRelease'...
When I commented out the metadata in the Manifest, the program started to compile again.
Just Enable multidex in app/build.gradle file.
defaultConfig {
....
multiDexEnabled true
}
dependencies {
.....
implementation 'com.android.support:multidex:2.0.1'
}
You just only run 'get packages' in your pubspec.yaml and the probles will be solve
you can solve this issue by following these step which is given in this link
https://medium.com/#sahaishashank2507/the-gradle-failure-may-have-been-because-of-androidx-incompatibilities-in-this-flutter-app-39b34acee40e?source=---------2------------------
You need to open your project in the android studio.
select Refactor->Migrate to Androidx(You need to migrate Android Project not
flutter one)
Android Studio finish some process you have to wait for it .
Than rebuild your project and it will work fine.
it can resolve your issue

Categories

Resources