Flutter Could not resolve project :shared_preferences Required by: project :shared_preferences - android

I have a flutter project which is working fine on another machine. When I cloned the project to my machine I got this error
Could not resolve all task dependencies for configuration
':shared_preferences:debugCompileClasspath'. Could not resolve project
:shared_preferences_macos. Required by: project :shared_preferences
Unable to find a matching configuration of project :shared_preferences_macos:
None of the consumable configurations have attributes. Could not resolve project :shared_preferences_web. Required by: project
:shared_preferences
Unable to find a matching configuration of project :shared_preferences_web:
None of the consumable configurations have attributes.
This is my flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows
[Version 10.0.18362.900], locale en-US)
• Flutter version 1.12.13+hotfix.9 at C:\flutter
• Framework revision f139b11009 (3 months ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[√] Android toolchain - develop for Android devices (Android SDK
version 29.0.2)
• Android SDK at C:\Users\Administrator.SHADY-LAPTOP\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.41.1)
• VS Code at C:\Users\Administrator.SHADY-LAPTOP\AppData\Local\Programs\Microsoft
VS Code
• Flutter extension version 3.7.1
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• No issues found!

After an extensive search, I noticed that the flutter cache folder seems to be corrupted
I run the command flutter pub cache repair and I took a while to download all the cache folder which contains all the packages that you have a cache for.
Finally, the issue is resolved.

I think this has to do with some project updates. You can try this if you still havent got an answer...
Put the below code into the pubsec.yaml file ...
shared_preferences: ^0.5.6
url_launcher: ^5.4.0

Related

Missing files / Cannot resolve symbols and classes in Android folder for Flutter Project

I tried using the solutions online but nothing worked.
Deleted android folder and ran 'flutter create .'
Ran 'gradlew clean build' but the build was failed
* What went wrong:
Could not compile build file 'C:\Users\EVO.store\StudioProjects\playground2point0\android\build.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 62
Updated my JAVA_HOME variable to 'C:\Program Files\Java\jdk-18'
I honestly have no idea what to do anymore, the main.dart file works just fine. But I'd like to edit a few things for the android version.
What exactly am I missing here?
Here's what it looks like:
https://imgur.com/a/bQ4mNXx
Here's my Flutter doctor output:
[√] Flutter (Channel stable, 2.10.4, on Microsoft Windows [Version 10.0.22000.556], locale en-US)
• Flutter version 2.10.4 at C:\Users\EVO.store\Documents\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (3 weeks ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\EVO.store\AppData\Local\Android\sdk
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Users\EVO.store\AppData\Local\Google\Chrome\Application\chrome.exe
[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32210.238
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2021.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
[√] VS Code (version 1.65.2)
• VS Code at C:\Users\EVO.store\AppData\Local\Programs\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.556]
• Chrome (web) • chrome • web-javascript • Google Chrome 71.0.3578.98
• Edge (web) • edge • web-javascript • Microsoft Edge 100.0.1185.39
[√] HTTP Host Availability
• All required HTTP hosts are available

Flutter - Error: Null safety features are disabled for this library

I have been working on a flutter project for a long time. Now I have set up my new laptop and after reinstalling the tools for VS Code(Flutter, Android Studio) I face the error mentioned in the title of this question.
Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
As advised, I have set my flutter-sdk version to >= 2.10.0 but it is still not working.
To enable the NNBD I would have to enable experimental support but people advise against it until it is fully released. So what should I do to get my codebase working? Enable NNBD experimental support or is there any other solution?
Here is my flutter doctor:
[√] Flutter (Channel stable, 1.22.3, on Microsoft Windows [Version 10.0.19041.572], locale en-AT)
• Flutter version 1.22.3 at C:\flutter
• Framework revision 8874f21e79 (6 days ago), 2020-10-29 14:14:35 -0700
• Engine revision a1440ca392
• Dart version 2.10.3
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\xyz\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.50.1)
• VS Code at C:\Users\xyz\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.16.0
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.0.0 (API 26) (emulator)
! Doctor found issues in 2 categories.
If needed, I will provide extra information/logs/files.
I resolved running flutter clean and flutter pub get again.

Error while trying to build flutter project

I am facing problems with the build of my apps(the old ones are working but all my new projects are receiving this message)
i already tried rebooting my pc and reinstalling flutter, but this doesn't change the error, and i can't find the solution anywhere
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
'D:\projects\CalendarProject' is not recognized as an internal or external command,
operable program or batch file.
Exception: Gradle task assembleDebug failed with exit code 1
this projects\CalendarProject is a old project, but every project i try to build i receive this message pointing to D:\projects\CalendarProject
also my flutter doctor seems perfectly fine
[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [Version 10.0.18363.1082], locale en-US)
• Flutter version 1.20.4 at C:\src\flutter
• Framework revision fba99f6cf9 (4 days ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at D:\android\AndroidVirtual
• Platform android-29, build-tools 29.0.3
• ANDROID_SDK_ROOT = D:\android\AndroidVirtual
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[!] IntelliJ IDEA Community Edition (version 2019.1)
• IntelliJ at C:\Users\Joâo Pedro\IntelliJ IDEA Community Edition 2019.1.3
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
[√] VS Code (version 1.49.0)
• VS Code at C:\Users\Joâo Pedro\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.14.1
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
I think it is a config in android folder that is generating this error, but can't imagine what could it be
Are you using flutter in android studio? if so, try opening the project in "vs code", there seems to be a problem with flutter in android studio...
Solved:
the folder that i was using to create projects was inside a folder called "D:\projects\CalendarProject(V3)" (exemple:D:\projects\CalendarProject(V3)\flutter_app)
, don't know is it is a android sdk or flutter bug, but apperently one of them thought CalendarProject(V3) was a function and was trying to run it. this explains the message
'D:\projects\CalendarProject' is not recognized as an internal or external command,
operable program or batch file.
Fixed by changing the directory
you can recreate the error with:
>>mkdir teste(v3)
>>cd "teste(v3)"
>>flutter create app
>>cd app
>>flutter build apk

FLUTTER ERROR sdkmanager error!!! Windows 10

AndroidStudio is updated everything is updated I think error come from here C:\Users\lanet\AppData\Local\Android\sdk\tools\bin\sdkmanager because this folder couldnt created when I looked to there I'm waiting for advises . thank you
C:\Users\lanet>flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.592], locale tr-TR)
• Flutter version 1.12.13+hotfix.8 at C:\src\flutter
• Framework revision 0b8abb4724 (3 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\lanet\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.42.1)
• VS Code at C:\Users\lanet\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
C:\Users\lanet>flutter doctor --android-licenses
Android sdkmanager tool not found (C:\Users\lanet\AppData\Local\Android\sdk\tools\bin\sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.dev/setup/#android-setup for detailed instructions.
Scroll down and Download Command line tools only from this link.
Put your Downloaded file (tools) in this location:
C:\Users\ABC\AppData\ABC\Android\Sdk
Close your android studio , and again open android studio. And check update.
Open command line and pass:
flutter doctor --android-licenses
And press y for accept.
Run flutter doctor you should be good.

flutter embedding - Upgrading Pre 1.12 Android Projects Breaks Plugins

While building my flutter project, I was forced to follow the instructions in this link https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects for my shared_preferences package to work.
I followed the instructions there. Now my plugins seem to not work. for example signing with google throws this error: error MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
Similar errors happen with almost all of my plugins.
here is my flutter doctor -v logs
• Flutter version 1.10.15-pre.404 at C:\src\flutter
• Framework revision 9093cf15f6 (2 hours ago), 2019-11-04 22:30:16 -0500
• Engine revision 7b968ff95f
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at C:\Users\Ajmal Jalal\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.1
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 41.0.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.39.2)
• VS Code at C:\Users\Ajmal Jalal\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.5.1
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
! Doctor found issues in 1 category. ```
This question was answered here in flutter's github page, and the answer there resolved my issue:
https://github.com/flutter/flutter/issues/44161

Categories

Resources