Error while using flutter background_location package - android

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

Related

Why I am getting this error after Flutter Run?

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

Flutter: upgrading firebase_ml_vision dependency from 0.9.x to 0.10.0

My flutter project runs fine with Firebase ML Vision 0.9.x, if I try to upgrade to 0.10.0 (or higher), it yields the following errors:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\...\Cache\hosted\pub.dartlang.org\firebase_ml_vision-0.10.0\android\build.gradle' line: 26
* What went wrong:
A problem occurred evaluating project ':firebase_ml_vision'.
> Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':firebase_ml_vision'.
> compileSdkVersion is not specified. Please add it to build.gradle
* 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 889ms
Exception: Gradle task assembleDebug failed with exit code 1
The first of those two errors is weird because the setup instructions and the package install guidelines both say that firebase_core is not required (anymore).
The second is just plain wrong, as my app's build.gradle specifies compileSdkVersion 30 and the firebase_ml_vision package's build.gradle specifies compileSdkVersion 29.
Any ideas what's going on?
Found a solution that works:
Ignore the setup instructions and add firebase_core as a dependency. Then, add the 'implementations' according to this thread to solve the 'Duplicate class' issues.

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 path_provider Error - Could not resolve project :path_provider_linux

I have implemented various methods but errors appear every time I run android.
If you delete the path_provier_macos folder, a linux error appears.
You are currently using path_provier: ^1.6.11. Lowering the path_provier version is the same.
Please tell me the solution.
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':path_provider:compileDebugAidl'.
> Could not resolve all task dependencies for configuration
':path_provider:debugCompileClasspath'.
> Could not resolve project :path_provider_macos.
Required by:
project :path_provider
> Unable to find a matching configuration of project :path_provider_macos:
- None of the consumable configurations have attributes.
> Could not resolve project :path_provider_linux.
Required by:
project :path_provider
> Unable to find a matching configuration of project :path_provider_linux:
- None of the consumable configurations have attributes.
* 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 12s
Finished with error: Gradle task assembleDebug failed with exit code 1
Go to your Flutter sdk folder.
Go to [.pub-cache\hosted\pub.dartlang.org\ or .pub-cache\hosted\pub.flutter-io.cn\ ]
Remove all path_provider folders.
Pub get
Run your app.
I hope this fix your problem!

Android Gradle update to 6.2.2 NoSuchMethodError with DeprecationLogger.nagUserWith

When I update in an Android project Gradle to 6.2.2 from 6.1.1 I run into this non-understandable error.
> Configure project :commonLib
The BuildListener.buildStarted(Gradle) method has been deprecated. This is scheduled to be removed in Gradle 7.0. Consult the upgrading guide for further information: https://docs.gradle.org/6.2.2/userguide/upgrading_version_5.html#apis_buildlistener_buildstarted_and_gradle_buildstarted_have_been_deprecated
at build_bpg7owlpe9pidz38268q3rf54.run(/builds/cross/mxtracks/commonLib/build.gradle:1)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
Internal API constructor DefaultDomainObjectSet(Class<T>) has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use ObjectFactory.domainObjectSet(Class<T>) instead. See https://docs.gradle.org/6.2.2/userguide/custom_gradle_types.html#domainobjectset for more details.
at build_bpg7owlpe9pidz38268q3rf54.run(/builds/cross/mxtracks/commonLib/build.gradle:1)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
> Configure project :MXApp
Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':MXApp'.
> Failed to notify project evaluation listener.
> java.lang.NoSuchMethodError: org.gradle.util.DeprecationLogger.nagUserWith(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
> KotlinJvmAndroidCompilation with name 'paidRelease' not found.
* 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 1m 3s
I'm out of ideas, even
defaultConfig {
...
android.ndkVersion '21.0.6113669'
}
shows the same result. Maybe someone can help ?
I found the reason, running the gradle task with --stacktrace helps me to find the reason.
It was gradle-play-publisher and this release 2.7.5 solved it finally

Categories

Resources