Flutter users should run 'flutter pub get' instead of 'pub get' - android

When i try to open most of downloaded flutter app in android studio it keeps telling me 'Pub get' has not been run and when i press 'get dependencies' or upgrade dependencies' it shows me that error . I have upgraded android studio and flutter and dart to the latest version
Error :
C:\Dart\dart-sdk\bin\pub.bat get
Resolving dependencies...
Because wisgen depends on flutter_test any from sdk which doesn't exist (the Flutter SDK is not
available), version solving failed.
Flutter users should run `flutter pub get` instead of `pub get`.
Process finished with exit code 69
This is the pubspec.yaml of the project
name: wisgen
description: A Wisdom Generator
#for release: flutter build apk --release
#for release: flutter build appbundle --build-number=2
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.4+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
http: ^0.12.0+2
cached_network_image: ^1.1.1
shared_preferences: ^0.5.3+4
share: ^0.6.2+1
flutter_spinkit: "^4.0.0"
flutter_bloc: ^0.21.0
equatable: ^0.6.1
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
dev_dependencies:
flutter_launcher_icons: "^0.7.2"
mockito: ^4.1.1
flutter_test:
sdk: flutter
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/ball-col-3.png"
#flutter pub get
#flutter pub pub run flutter_launcher_icons:main
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages

after i update flutter i got this issue i tried everything nothing worked for me
then deleted .package and hit save in pubspec ,,
work like a charm

Go to the top menu 'Tools > Flutter > Flutter Clean'
Normally there is a problem with Flutter SDK not being set up (can be other problems too)

Related

in TabController in vcync:"property" problem ? and in pubspec file can not get font and images?

i got this type of error error image
and in pubspec file only one file get error that can not get any image and font family form pubpce
and The error "can not allow in vsync property" in Flutter might indicate that there is an issue with the vsync property you are trying to set.
in TabController.
and in pubspec file dont show any error regarding image and font.
and yes before using images and font working properly or i am applying any off file new image or font can not get on display
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: '>=2.18.6 <3.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
hovering: ^1.0.4
hover_effect: ^0.6.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
google_fonts: ^4.0.3
video_player: ^2.5.1
slider_button: ^2.0.0
animations: ^2.0.7
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:\
assets:
- assets/images/
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: GallientRegular
fonts:
- asset: assets/fonts/GallientRegular-eZoMp.ttf
- family: Playfair_Display
fonts:
- asset: assets/fonts/PlayfairDisplay-VariableFont_wght.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
You need to use TickerProviderStateMixin/SingleTickerProviderStateMixin to get vertical-sync
like
class _FAState extends State<FA> with SingleTickerProviderStateMixin {
late final controller = TabController(length: 3, vsync: this);
Also you can use initSate instead of late.

When I use Flutter build apk, I get errors like this "a uses or overrides a deprecated API."

I got this error after logging in with google.
I have looked for many solutions on the Internet for 2 days but none of them solved the problem. I opened a new project and transferred it there, but it didn't work either.
Some of the methods I use:
1-flutter clean,flutter build apk
2-flutter run -verbose
3-Delete Android/.gradle
4-dart fix --dry-run,dart fix --apply
pubspec.yml code
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.16.1 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
cloud_firestore: ^3.1.14
cupertino_icons: ^1.0.4
firebase_auth: ^3.3.17
firebase_core: ^1.16.0
firebase_storage: ^10.2.15
flutter:
sdk: flutter
google_sign_in: ^5.3.0
image_picker: ^0.8.5
path: ^1.8.0
rflutter_alert: ^2.0.4
shared_preferences: ^2.0.13
dev_dependencies:
flutter_lints: ^1.0.0
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
uses-material-design: true
assets:
- image/lgscreen.png
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
These are warnings of the Gradle compiler plugin. It checks whether your code (or code of your dependencies) uses deprecated function calls at some point.
In your example, the code which uses deprecated features is part of libraries provided by Google.
Deprecation means, that the provider of a specific library emphasizes on not using a specific method as it may be removed in future releases.
There is not much you can do, if the message relates to code that you don't maintain. You could inform the maintainer of the library, though.
The build seems to succeed. During runtime, there seems to be an issue with the MainActivity – there are multiple reasons why this happens:
Flutter app is not runnig on physicial device
Error type 3 Error: Activity class {} does not exist

How can I solve this Flutter SDK version error?

The current Flutter SDK version is 0.0.0-unknown.
Because provider 5.0.0 requires Flutter SDK version >=1.16.0 and no versions of provider match >5.0.0 <6.0.0, provider ^5.0.0 is forbidden.
So, because flutter_app depends on provider ^5.0.0, version solving failed.
Pub get failed (1; So, because flutter_app depends on provider ^5.0.0, version solving failed.)
That's the error I’m getting when trying to run 'flutter pub get' in Android Studio.
Below is the pubspec.yaml file:
Please note, I’m running Android Studio on macOS.
name: flutter_app
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.15.1 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
mqtt_client: ^7.2.1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
provider: ^5.0.0
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/outline_settings_white_18.png
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
Your Flutter probably had a problem while installing.
You can use Git commands to fix it.
Run these commands on your Flutter SDK, not on your project files.
git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor
You can check this thread on GitHub.
Go to the terminal and upgrade the SDK version by the
flutter upgrade
Command. This command is for both Mac and Windows.
If it shows an error, run
flutter upgrade --force

Execution failed for task ':google_sign_in:verifyReleaseResources'. Flutter google sign in

I have created an app with flutter and firebase and i am trying to create the build apk. but i get error when running flutter build apk. i think it is because my google sign in is not setup for release.
Execution failed for task ':google_sign_in:verifyReleaseResources'.
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
E:\Mobile App evelopment\
Fiverr\pet_walker\build\google_sign_in\intermediates\res\merged\
release\values\values.xml:314: error: resource android:attr/fontVariationSettings not found.
I have signed android apk but i have not got sha-1 production certificate for flutter. someone please guide me how to setup google sign in for production
here is the pubspec.yaml file
name: pet_walker
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
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.3
firebase_auth: ^0.15.0+1
cloud_firestore: ^0.13.7
provider: ^4.3.1
flutter_spinkit: "^4.1.2"
flutter_facebook_login: ^3.0.0
google_sign_in: ^3.2.4
after_layout: ^1.0.7+2
firebase_storage: ^3.1.6
image_picker: ^0.6.7+4
uuid: 2.2.0
cached_network_image: ^2.2.0+1
popup_menu: ^1.0.5
google_maps_flutter: ^0.5.28+1
geolocator: ^5.3.2+2
latlong: ^0.6.1
carousel_slider: ^2.2.1
geocoder: ^0.2.1
geoflutterfire: ^2.1.0
firebase_core: ^0.4.2
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages

Flutter import 'package:flutter_svg/flutter_svg.dart'; not working on the VS code and Android studio

I created a Flutter project, and I have an error on the line:
import package:flutter_svg/flutter_svg.dart
I already followed this structure from flutter_svg documentation.
It does not get identified on VS Code and Android Studio.
Any solution for this?
This is my pubspec.yaml
name: first_project
description: A new Flutter project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_svg: ^0.18.0
google_fonts: ^1.0.0
flutter_swiper: ^1.1.6
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/icons/
- assets/images/
- assets/svg/
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
Always remember, indentation plays a huge deal in pubspec.yaml files. Anyway, your dependencies in pubspec.yaml should look something like this:
dependencies:
flutter:
sdk: flutter
flutter_svg: ^0.18.0
google_fonts: ^1.0.0
flutter_swiper: ^1.1.6
Run this package on the terminal
flutter pub add flutter_svg

Categories

Resources