Unable to use Hive Plugin in Flutter - android

flutter pub get give error
Running "flutter pub get" in practice...
Because every version of flutter_test from sdk depends on quiver 2.1.3 and practice depends on quiver 2.1.0, flutter_test from sdk is forbidden.
So, because practice depends on flutter_test any from sdk, version solving failed.
pub get failed (1; So, because practice depends on flutter_test any from sdk, version solving failed.)
exit code 1
version I am using
[√] Flutter (Channel dev, v1.18.0, on Microsoft Windows [Version 10.0.18363.752], locale en-IN)
• Flutter version 1.18.0 at C:\src\flutter
• Framework revision 8f7327f83a (3 weeks ago), 2020-04-06 22:11:01 -0400
• Engine revision 49891e0653
• Dart version 2.8.0 (build 2.8.0-dev.20.0 1210d27678)

Both flutter_test and practice depends on quiver package, but each with different version.
You can force using the latest version of quiver which should allow you to pass the flutter pub get with no errors:
dependency_overrides:
quiver: 2.1.3

You may need to add one plugin.
dependency_overrides:
dartx: ^0.3.0

Related

error when using the flutter url_launcher: ^5.4.2 i get G:/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_platform_interface-1.0.9/lib/link

When I add the url_launcher: ^5.4.2 to my pubspec.yaml and I run my flutter app.
Then I get this error:
> /G:/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_platform_interface-1.0.9/lib/link.dart:85:21:
> Error: Method not found: 'SystemNavigator.routeInformationUpdated'.
> SystemNavigator.routeInformationUpdated(location: routeName);
> ^^^^^^^^^^^^^^^^^^^^^^^ /G:/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_platform_interface-1.0.9/lib/link.dart:108:12:
> Error: Getter not found: 'Router'.
> return Router.of(context) != null;
> ^^^^^^
And my flutter version is :
Flutter 1.22.0 • channel master • https://github.com/flutter/flutter.git
Framework • revision 7ec2d360bc (11 months ago) • 2020-07-29 23:25:38 -0700
Engine • revision a9910e409c
Tools • Dart 2.10.0 (build 2.10.0-1.0.dev 24c7666def)
You need to update your flutter sdk I think.
My flutter version shows 2.0.6 and new version than this is also available.
Latest version of url_launcher is: url_launcher 6.0.6
So update this two things first this might solve your problem.
How to upgrade flutter sdk? (Run these commands in terminal)
$ flutter channel dev
$ flutter upgrade
You can install latest sdk directly using:
git clone https://github.com/flutter/flutter.git -b stable
I have installed url_launcher 6.0.6 version and app is running fine, here is my flutter sdk details:
Flutter 2.0.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1d9032c7e1 (7 weeks ago) • 2021-04-29 17:37:58 -0700
Engine • revision 05e680e202
Tools • Dart 2.12.3
Solution 1 ) Lower down the library version to somewhere like 5.7.0, 5.7.1, 5.7.2, 5.7.4, 5.7.5
NOTE :- If you still face the issue
Go to this directory /G:/flutter/.pub-cache/hosted/pub.dartlang.org/
and delete url_launcher_platform_interface
Then run flutter clean then flutter pub get
Solution 2 ) Update your SDK to Latest to use latest library in your project
DOING THIS ALONE MIGHT SOLVE YOUR PROBLEM
Go to this directory /G:/flutter/.pub-cache/hosted/pub.dartlang.org/
and delete url_launcher_platform_interface
Then run flutter clean then flutter pub get

Flutter issues with Android Firebase dependencies after Dependency Upgrades

i recently decided to upgrade my Flutter dependencies and pubspec.yaml all to newest versions according to pub.dev.
As i mainly tested with iOS i just realised pretty late, that my android build did not work any longer. The Error Message unfortunately was very low on direct information.
Gradle sync failed: Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Problems reading data from Binary store in /private/var/folders/mw/s9362rr10qv43x_yh6qgm17w0000gn/T/gradle8805841490318013448.bin offset 286370 exists? true
Consult IDE log for more details (Help | Show Log) (25 s 303 ms)
I however decided to also provide my android studio an update to 4.1 and upgraded also the gradle dependencies.
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2' // 3.5.1
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4' // 4.3.3
}
The new attempt in android studio was providing a more relatable error in reference to Firebase
Gradle sync failed: Problems reading data from Binary store in /private/var/folders/mw/s9362rr10qv43x_yh6qgm17w0000gn/T/gradle1329056569736096566.bin offset 296201 exists? true
Corrupt serialized resolution result. Cannot find selected module (224) for constraint platform-runtime -> com.google.firebase:firebase-iid:21.0.1
Consult IDE log for more details (Help | Show Log) (10 m 18 s 294 ms)
My Flutter Doctor -v gives me confidence that everything is fine. (the Plugin Errors are an existing and known issue by the Flutter team with Android Studio 4.1 and not related)
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.1 20C69 darwin-x64, locale de-DE)
• Flutter version 1.22.6 at /Users/kaibaier/development/flutter
• Framework revision 9b2d32b605 (5 days ago), 2021-01-22 14:36:39 -0800
• Engine revision 2f0af37152
• Dart version 2.10.5
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/kaibaier/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/kaibaier/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.9.3
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.52.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.18.1
[✓] Connected device (1 available)
• Redmi Note 8 (mobile) • 18d3ce30 • android-arm64 • Android 10 (API 29)
For the sake of completion i also add the pubspec.yaml dependencieswith the previous used Version. You will notice the big Version jump in Firebase and Google Maps
dependencies:
flutter:
sdk: flutter
permission_handler: ^5.0.1+1
cupertino_icons: ^1.0.0 #^0.1.3
firebase_core: ^0.7.0 # ^0.5.0
firebase_auth: ^0.20.0+1 # ^0.18.0+1
firebase_storage: ^7.0.0 # ^4.0.0
cloud_firestore: ^0.16.0 #^0.14.0+2
provider: ^4.3.3 #^4.3.2
flutter_spinkit: ^4.1.2+1
flutter_vector_icons: ^0.2.1
intl: ^0.16.1
image_cropper: ^1.3.1
image_picker: ^0.6.7+21 #^0.6.7+11
searchable_dropdown: ^1.1.3
flutter_colorpicker: ^0.3.5 #^0.3.4
flutter_masked_text: ^0.8.0
shared_preferences: ^0.5.12+4 #^0.5.8
path_provider: ^1.6.27 #^1.6.11
location: ^3.2.4 #^3.0.2
table_calendar: ^2.3.3 #^2.2.3
url_launcher: ^5.7.10 #^5.6.0
google_maps_flutter: ^1.1.1 #^0.5.32
flutter_google_places: ^0.2.6
http: ^0.12.2 #^0.12.1
uuid: ^2.2.2 #^2.0.4
flutter_appcenter_bundle: ^3.2.0+2
preload_page_view: ^0.1.4
device_preview: ^0.5.5 #^0.4.8
wakelock: ^0.2.1+1 #^0.1.4+2
Any help / ideas or thoughts are very welcome :)
UPDATE:
After trying to run the Test again on my android phone i run into another related error.
Note: /Users/kaibaier/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Problems reading data from Binary store in /private/var/folders/mw/s9362rr10qv43x_yh6qgm17w0000gn/T/gradle3299415366350440389.bin offset 0 exists? true
* 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.
UPDATE #2:
I also posted the issue over here in GitHub
https://github.com/FirebaseExtended/flutterfire/issues/4848
UPDATE #3:
Ok i was able to figure out that this file: /private/var/folders/mw/s9362rr10qv43x_yh6qgm17w0000gn/T/gradle3299415366350440389.bin
only exists during a build phase. After the error is thrown, it is directly gone again.
Update #4:
I rolled back to the old firebase dependencies for now. Just upgraded the firebase storage. All runs smoothly after some pod and Grasflecks clean.
My issue still exists, as I hope to get back to the new versions of firebase dependencies . But for now I can build again .
I had exactly the same issue after a firebase upgrade. Along with pubspec.yaml There is another (somewhat hidden) dependency you need to upgrade in app/build.gradle. I changed mine from 17.x to this and all builds and runs.
implementation 'com.google.firebase:firebase-analytics:18.0.2'

Error ":app:transformClassesWithDexBuilderForDebug" when upgrade to new version of flutter

I upgrade flutter from v1.91. hotfix 6 by using flutter upgrade --force.
Then i build an example "layers" - flutter run, it shows this message, while if i switch to 1.91, everything built ok
flutter run --stacktrace gives this error
Could not find an option named "stacktrace".
flutter doctor -v
G:\new\new_exam>flutter doctor -v [√] Flutter (Channel stable,
v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.535],
locale en-US) • Flutter version 1.12.13+hotfix.5 at G:\Flutter\flutter
• Framework revision 27321eb (12 days ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6 • Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK
version 29.0.2) • Android SDK at G:\Flutter\android • Android NDK
location not configured (optional; useful for native profiling
support) • Platform android-29, build-tools 29.0.2 • ANDROID_HOME =
G:\Flutter\android • ANDROID_SDK_ROOT = G:\Flutter\android\sdk • Java
binary at: G:\flutter\openjdk\bin\java • Java version OpenJDK Runtime
Environment (build 1.8.0_232-b09) • All Android licenses accepted.
[!] Android Studio (not installed) • Android Studio not found;
download from https://developer.android.com/studio/index.html (or
visit https://flutter.dev/setup/#android-setup for detailed
instructions).
[!] IntelliJ IDEA Community Edition (version 2019.3) • IntelliJ at
C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.1 X
Flutter plugin not installed; this adds Flutter specific
functionality. X Dart plugin not installed; this adds Dart specific
functionality. • For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[!] Connected device ! No devices available
! Doctor found issues in 3 categories.
1: https://i.stack.imgur.com/B4DTX.png
I feel the solution is pretty straight forward. Usually, it's always a best practice to use Android Studio when working with Flutter and Dart. Reasons are there are some dependencies that would require you to use Android Studio to have it work well for you, especially when you're just starting to work with Flutter and Dart.
Flutter Doctor is pretty precise as to the issues you're experiencing.
After downloading Android Studio, do the following;
Navigate to your Preferences or Android Studio Settings on PC, then select, Plugins, ensure the following plugins are installed.
Android APK Support
Android NDK Support
Dart
Flutter
EditorConfig
App Links Assistant
Google Services
Gradle
Properties Support
Java Bytecode Decompiler
Java Stream Debugger
Task Management
YAML
Among others which would be automatically installed by Android Studio for you, this should take that error away and you should be fine.
Then, before you probably run your App, if you see the get dependencies at the Top of your Android Studio, click the get dependencies so that Android studio can get the latest dependencies to run your App without issues.
Ensure you run a cold restart after each time you add a new dependency to your pubspec.yaml file.

Flutter Unable to read manifest info from app.apk

i have upgraded the flutter four days earlier and since then i am facing issue, the workspace has no errors as other collaborator's code is running fine.
Error is:
Error running com.xxxxxxxx.signals. Default activity not found
Unable to read manifest info from F:\Projects\xxxxxxxx-mobile\xxxxxxxx-mobile\build\app\outputs\apk\app.apk.
No application found for TargetPlatform.android_x86.
Is your project missing an android\app\src\main\AndroidManifest.xml?
Consider running "flutter create ." to create one.
i ran following commands in Visual Studio Code Terminal:
flutter clean
flutter run
the solutions i applied which unfortunately didnt work are:
Then i changed branch of the repository i have working in
Switched to dev, beta branches of flutter
Re installed emulator
attached real device
My flutter doctor is as follows:
[√] Flutter (Channel dev, v1.3.13, on Microsoft Windows [Version 10.0.17134.648], locale en-US)
• Flutter version 1.3.13 at C:\src\flutter
• Framework revision 59ce7d6bff (2 days ago), 2019-03-18 11:20:10 -0700
• Engine revision e75f6de01f
• Dart version 2.2.1 (build 2.2.1-dev.1.1 None)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\jabir\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 32.0.1
• Dart plugin version 182.5124
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[√] VS Code (version 1.32.3)
• VS Code at C:\Users\jabir\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 2.24.0
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
• No issues found!
I encountered a similar problem and o fixed it by deleting the app.apk in the build/app/outputs/apk directory and it worked.
I resolved this by these step.
upgraded flutter
created new other project using flutter create foo
compared foo project with my project
removed kotlin setting from my project
changed androidx to android.support packages in gradle dependencies
copied and modified *.iml files for my project (although these files are ignored)
flutter clean
flutter run
I used VS editor.
My Project dependencies. pubspec
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: ^0.15.7
http: ^0.12.0+1
firebase_core: ^0.3.4
firebase_analytics: ^2.1.1
firebase_auth: ^0.8.4+2
firebase_remote_config: ^0.1.0+2
firebase_database: ^2.0.2
firebase_storage: ^2.1.0+1
video_player: ^0.10.0+4
chewie: ^0.9.7
in my case it happened cause I defined an intent filter for notification inside main application tag in manifest and declared an application service that receives it in manifest after main application tag and that is wrong
The right to change main application tage name to the new application tag not to put the both
This Error is because the flutter does not find the SDK path. You just need to set the SDK Path by following the command using the terminal.
flutter config --android-sdk $SDK_PATH

Flutter build_runner package will not update

I have a weird Flutter 'get packages' issue:
Setup:
The project I am working on, up to this point has been using a rather basic, home-brewed model system. We have some functions to consume data, and without much validation, assign it to object keys inside immutable objects. It is rather crude, and we want to standardize on something more widely used, and hopefully robust.
Some recent research has pointed us to the built_value package, because it seems to offer not only a more standard way of defining models, but also can cut down on boiler plate that we have been writing over and over. We found some instructions online for adding this to our project. Essentially, we have to add two dependencies and two dev_dependencies. Here is what the basis pubspec.yaml looks like:
name: projectname
description: my project rocks!
version: 1.0.0
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: 'flutter'
...
built_collection: '^4.1.0'
built_value: '^6.3.0'
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: '^1.2.1'
built_value_generator: '^6.3.0'
And this is what flutter doctor says:
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version
10.0.17134.523], locale en-US)
• Flutter version 1.0.0 at c:\flutter\flutter
• Framework revision 5391447fae (9 weeks ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at C:\Users\MYUSER\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 32.0.1
• Dart plugin version 182.5124
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[√] Connected device (1 available)
• MY PHONE
• No issues found!
Issue:
On the surface, it looks like everything is ok. But then, in Intellij (where all this above was copied from), I use the flutter 'Packages get' command (even using the commandline version inside the project dir, I get the same results):
Running "flutter packages get" in projectname...
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
Because build_runner >=1.2.0 depends on build_daemon >=0.2.0 which requires SDK version >=2.1.0 <3.0.0, build_runner >=1.2.0 is forbidden.
So, because projectnamedepends on build_runner ^1.2.1, version solving failed.
pub get failed (1)
Process finished with exit code 1
Now, the interesting part is that I have it set to use the 'stable' branch of flutter, which is currently at version "2.1.0-dev.9.4.flutter-f9ebf21297" which flutter doctor is registering as version "2.1.0". However, when trying to do the packages get command flutter seems to think that "2.1.0-dev.9.4.flutter-f9ebf21297" is not ">=2.1.0 <3.0.0".
All of the versions for the packages are the latest versions, according to their git repos. Flutter is up to date with the latest stable branch (I have redone this twice now to make sure). Flutter doctor command seems to think that everything is correct... and yet I cannot complete the 'packages get' command because build_daemon (a dep of build_runner) requires ">=2.1.0 <3.0.0" and the flutter script is not recognizing that version "2.1.0-dev.9.4.flutter-f9ebf21297" >= "2.1.0", which by it's own admission in flutter doctor, it is.
Request:
I have been racking my brain for solutions. I have tried switching to the master branch for flutter manually, but when I run it from Intellij, it switches right back to stable. I have tried a complete reinstall of flutter, and that did not help. I have been fighting with these things for a while now, thinking that I am doing something wrong, and have not made any headway. I have read every piece of documentation I can find on the topic, and nothing seems to indicate that anyone other than me is having this issue. So I am at a loss.
I am reaching out to the community, in an attempt to get this working. I feel like I am missing something glaringly obvious here, and I think having your eyes look at this in addition to mine, will help solve the issue. What do you suggest I do to resolve this issue?
Thanks in advance,
Loushou
Based on the release notes, this should be fixed on the later versions. The current version is build_runner: ^2.1.5 and this supports the null safety feature.
I suggest for this kind of situation to always check if the latest version of a plugin is available and use it. Most of the time the bugs/errors from the previous versions was being addressed on the succeeding versions.

Categories

Resources