I'm trying to use geolocator to get users location. However after installing dependencies and running it. I get a ton of errors. When I remove it and rerun, all errors are gone. I've tried multiple versions of the plugin and still same error. Here's my log output:
WARNING: This version of firebase_core will break your Android build if it or its dependencies aren't compatible with AndroidX.
See "url" for 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.
*********************************************************
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
Output: C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:905: error: resource android:attr/fontVariationSettings not found.
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:905: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Command: C:\Users\Mike\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\4564870280758e11a31e0f822b4b55cc\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
C:\Users\Mike\AppData\Local\Android\sdk\platforms\android-27\android.jar\
--manifest\
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
#C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
C:\Users\Mike\Documents\HikeLocator\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.hikelocator.hikelocator\
-0\
apk\
--output-text-symbols\
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
Output: C:\Users\Mike\.gradle\caches\transforms-1\files-1.1\appcompat-1.0.1.aar\ff2bf124a1c2911ea68cc7f1f5d69383\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.
C:\Users\Mike\.gradle\caches\transforms-1\files-1.1\core-1.0.1.aar\b0d75b3838389273bb7c4663ccc599be\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\Mike\.gradle\caches\transforms-1\files-1.1\core-1.0.1.aar\b0d75b3838389273bb7c4663ccc599be\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Command: C:\Users\Mike\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\4564870280758e11a31e0f822b4b55cc\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
C:\Users\Mike\AppData\Local\Android\sdk\platforms\android-27\android.jar\
--manifest\
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
#C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
C:\Users\Mike\Documents\HikeLocator\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.hikelocator.hikelocator\
-0\
apk\
--output-text-symbols\
C:\Users\Mike\Documents\HikeLocator\build\app\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
* 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 7s
Finished with error: Gradle task assembleDebug failed with exit code 1
I even commented out the firebase_core one thinking it might be conflicting with geolocator, but I'm still getting the same error. Here are my dependencies:
dependencies:
google_maps_flutter: ^0.0.3+3
geolocator: ^3.0.0
http: ^0.12.0
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
firebase_auth: ^0.5.8
#firebase_core: ^0.3.0+2
firebase_database: ^2.0.1+1
Any ideas? Thanks
It's that some of the libraries you depend on supports AndroidX while the others don't. For AndroidX -less solution
Try replacing:
geolocator: ^3.0.0
with:
geolocator: ^2.1.1
permission_handler: "2.1.2"
google_api_availability: "1.0.4"
More info here, here and here.
Related
Since the latest update to Cloud Firestore 3.4.3 I cannot build the Flutter app anymore.
/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3/android/src/main/java/io/flutter/plugins/firebase/firestore/streamhandler/TransactionStreamHandler.java:13: error: cannot find symbol
import com.google.firebase.firestore.TransactionOptions;
^
symbol: class TransactionOptions
location: package com.google.firebase.firestore
/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3/android/src/main/java/io/flutter/plugins/firebase/firestore/streamhandler/TransactionStreamHandler.java:66: error: package TransactionOptions does not exist
new TransactionOptions.Builder().setMaxAttempts(maxAttempts).build(),
^
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for 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 9s
Exception: Gradle task assembleDebug failed with exit code 1
Exited
I tried removing the folder /Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3 and performing flutter clean. Moreover I downgraded cloud_firestore to 3.3.0, but the folder was reinstalled with the same 3.4.3 version.
Any suggestion?
Here's everything I did to get that error gone.
Per this link:
flutter upgrade --force --verbose&&flutter update-packages --force-upgrade&&flutter pub upgrade --major-versions
Add to my main.dart:
import 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart' show FirebaseAuthPlatform;
Run flutter pub get -- notice no improvement.
So, additionally, I upgrade my pubspec.yaml manually:
firebase_core: ^1.21.0
cloud_firestore: ^3.3.0
firebase_auth: ^3.6.4
firebase_auth_platform_interface: ^6.5.4
cloud_firestore_odm: ^1.0.0-dev.27
Run flutter pub upgrade && flutter pub get
Now it works.
I wanted to use the latest version of Shared Preferences but when I ran pub get, it creates some error so I downgraded the plugin and the up b get works successfully but when I ran my app, this is what it said.
Launching lib\main.dart on INE LX2 in debug mode...
Running Gradle task 'assembleDebug'...
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/lib/shared_preferences.dart:14:8: Error: Error when reading '../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/shared_preferences_windows-0.0.2+3/lib/shared_preferences_windows.dart': The system cannot find the path specified.
import 'package:shared_preferences_windows/shared_preferences_windows.dart';
^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/lib/shared_preferences.dart:40:53: Error: Method not found: 'SharedPreferencesWindows'.
SharedPreferencesStorePlatform.instance = SharedPreferencesWindows();
^^^^^^^^^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\me\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\me\flutter\bin\flutter.bat'' 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 2m 57s
Exception: Gradle task assembleDebug failed with exit code 1
This is my pubspec.yaml dependency:
dependencies:
flutter:
sdk: flutter
carousel_slider: ^2.3.1
assets_audio_player: ^2.0.13+1
hive: ^1.4.4+1
path_provider: ^1.6.27
hive_flutter: ^0.3.1
flip_card: ^0.4.4
speech_recognition: ^0.3.0+1
easy_localization: ^2.1.0
translator: ^0.1.2
permission_handler: ^3.1.0
swipedetector: ^1.2.0
shared_preferences: ^0.5.7+3
I used this plugin because I saw one problem that tackles this problem in another Stack overflow. But still it did not solve the problem.
I first use shared_preferences version 0.5.10 and I had the same error so I downgraded to ver 0.5.7+3 and I still have this error. What should I do? If ever you need additional info please let me know, thank you.
[Solved]
I went for an older version as jeugene suggested to solve the below problem. The unavailable version is "0.1.1", the version I used is "0.0.7".
I keep getting the bellow error every time I try using the flutter_session package on a project. I've been wondering if there's someone out there who has had my kind of problem and can propose a solution.
Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.3.21/kotlin-stdlib-1.3.21.jar'. > Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.3.21/kotlin-stdlib-1.3.21.jar'. > jcenter.bintray.com: Temporary failure in name resolution > Could not get unknown property 'android' for project ':shared_preferences' of type org.gradle.api.Project. * 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 2m 10s Exception: Gradle task assembleDebug failed with exit code 1
My pubspec.yaml has these;
dependencies:
flutter:
sdk: flutter
flutter_svg: ^0.18.1
http: ^0.12.2
flutter_session: ^0.1.1
geolocator: ^6.0.0
geocoder: ^0.2.1
headup_loading: ^1.0.3
and I have these is the main.dart file;
import 'package:flutter_session/flutter_session.dart';
Is there something am doing wrong?
Is the spacing of the dependencies correct. Extra space can create errors in pubspec.yaml. Another possibility is that the specific version might not be available. Try older version of the same.
I am answering my own question here because I solved it after many hours of searching. This is NOT an already answered question, so please don't tag it as such. I wish it was, it would've saved me hours of frustration.
Flutter project is failing with this error. Fluttertoast error.
??: ?? ContextCompat
??: ? FluttertoastPlugin
2 ???
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':fluttertoast:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for 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 26s
*******************************************************************************************
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.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1
The underlying issue is that the android.support.v4.Content.ContextCompat import in fluttertoastplugin.java can't resolve the symbol ContextCompat. This is a dependency issue.
The solution is to go to your flutter project's pubspec.yaml and find the fluttertoast dependency and update it to the latest version (currently ^3.1.0)
dependencies:
flutter:
sdk: flutter
dropdown_formfield: ^0.1.0
camera: ^0.5.2+1
fluttertoast: ^3.1.0 <----- THIS ONE
path_provider: ^1.1.0
video_player: ^0.10.1
latlong: ^0.6.1
google_maps_flutter: ^0.5.11+1
http: ^0.12.0
flutter_blue: ^0.5.0
flutter_bluetooth_serial: ^0.0.5
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
In my case. I updated all dependencies in pubspec.yaml and it worked.
In my case all I did was run
flutter clean
and rerun project and everything worked fine.
after adding
location: ^1.4.1
to my dependencies in pubspec.yaml:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
rxdart: ^0.20.0
http: ^0.12.0
date_format: ^1.0.5
intl: ^0.15.7
fluttertoast: ^2.2.3
location: ^1.4.1
I do Packages get, and everything is fine, but when I try to build it, the app crashes with a message:
Launching lib\main.dart on Lenovo K33a48 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
D8: Program type already present: android.support.v4.app.INotificationSideChannel
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:
"Here goes the list of all jar archives"
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel
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
My targetSdk is 28. I use Android Studio 3.2.1
Help would be very much appreciated!
this happens because the library you are using uses the same dependences.
SOLUTION 1
in VSCode Search (Ctrl+Shift + P)
in your error android.support.v4.app.INotificationSideChannel. search for keywords Notification/Side/Channel. pick one.
If there are the same dependences, it means that there are duplicate libraries.
Solution: Delete one of the libraries you are using
SOLUTION 2 (Recommended)
in VSCode Search (Ctrl+Shift + P)
in your error android.support.v4.app.INotificationSideChannel. search for keywords Notification/Side/Channel. pick one.
Find a library that uses the same dependences, then update to the latest package version.
This solution will keep the library you are using without deleting it
I'm unable to replicate the behavior you've reported. The issue seems to have been resolved by a plugin update as you've mentioned in the comments. Running flutter clean should solve most conflicts caused in the dependencies cache.