Facing errors in flutter when using firebase - android

I am facing error in flutter when I use firebase. The app is not building. This is the error which I am facing:-
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task :app:preDebugBuild.
Android dependency 'androidx.lifecycle:lifecycle-runtime' has different version for the compile (2.0.0-rc01) and runtime (2.0.0) classpath. You should manually set the same version via DependencyResolution
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 help gradle
BUILD FAILED in 1m 44s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 108.0s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the
incompatibility.
Building plugin firebase_core...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 11.2s
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project firebase_core.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
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 help gradle
BUILD FAILED in 9s
The plugin firebase_core could not be built due to the issue above.
Here is my code in pubspec.yaml file:
cupertino_icons: ^0.1.2
firebase_database: ^1.0.5
firebase_core: 0.3.0
firebase_storage: 2.0.0
image_picker: ^0.6.0+1
url_launcher: ^4.1.0+1

Related

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

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 google maps android build failed

I tried to add google maps to my flutter project
dependencies:
geolocator: ^2.1.0
google_maps_flutter:
<manifest ...
<application ...
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="my key was here"/>
The problem is that after adding this dependence, every running - build failed with this message:
FAILURE: Build failed with an exception.
* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
project ':google_api_availability' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71
* 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 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
of course, I tried to change the gradle version to another one, as it advised in other posts, but it didn't help.
I really don’t know what the problem is, because without maps the project compiles, I checked.
You have to upgrade the geolocator package which depends on google_api_availability by running the command flutter pub upgrade

Android dependency 'androidx.core:core' has different version for the compile (1.0.0-rc01) and runtime (1.0.2) class path

What went wrong:
Execution failed for task ':app:preDebugBuild'.
Android dependency 'androidx.core:core' has different version for the compile (1.0.0- rc01) and runtime (1.0.2) classpath. You should manually set the same version via DependencyResolution
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 h../help.gradle.org
BUILD FAILED in 1s
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See for more information on the problem and how to fix it.
Finished with error: Gradle task assembleDebug failed with exit code 1

Could not find androidx.legacy:legacy-support-v4:27.0.2

I added geolocator dependency and then I get an error of android x incompatibility. can any help me to get out of this?
Launching lib\main.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not find androidx.legacy:legacy-support-v4:27.0.2.
Searched in the following locations:
- file:/C:/Users/Rutvik/AppData/Local/Android/sdk/extras/m2repository/androidx/legacy/legacy-support-v4/27.0.2/legacy-support-v4-27.0.2.pom
Required by:
project :app > project :image_picker
* 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 7s
****************************************************
Migrating all the dependancies to andriodx packages will resolve this issue. https://developer.android.com/jetpack/androidx/migrate
Here your geo-locator latest uses androidx packages where image_picker dependency uses android package. You need to update image_picker library to latest https://pub.dev/packages/image_picker#-changelog-tab-
or
Quick fix: Downgrade geo-locator to 2.1.1 to resolve this issue. This is not a best approach.
Upgrading all the dependancies to androidx compatable is best approach you can try.

Categories

Resources