This is taking an unexpectedly long time - android

When I am trying to add new dependency (packages) using flutter pub get in my flutter project i am getting This is taking an unexpectedly long time message.
All other commends working fine like flutter run, flutter doctor etc. Only for flutter pub get i am facing this issue. That's why i am unable to add new dependency (packages) in my flutter app.
Result of flutter doctor -v
[✓] Flutter (Channel stable, v1.17.0, on Linux, locale en_IN)
• Flutter version 1.17.0 at /home/suhask/private_work/Flutter/SDK/flutter_linux_1.17.0-stable/flutter
• Framework revision e6b34c2b5c (9 days ago), 2020-05-02 11:39:18 -0700
• Engine revision 540786dd51
• Dart version 2.8.1
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/suhask/Android/Sdk
• Platform android-28, build-tools 28.0.3
• Java binary at: /home/suhask/install_soft/android-studio-ide-183.5522156-linux/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b16-5323222)
• All Android licenses accepted.
[✓] Android Studio (version 3.4)
• Android Studio at /home/suhask/install_soft/android-studio-ide-183.5522156-linux/android-studio
• Flutter plugin version 39.0.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b16-5323222)
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.0.0 (API 26) (emulator)
• No issues found!
If anyone know how to solve this problem please help.

If you are working on Windows OS,
Close Android Studio
End process related to Flutter & Android Studio IDE from Task Manager.
Then, delete everything from Temp folder (run %temp% to open it directly).
Now, Open Android Studio and your Flutter project.
Run flutter pub get, it will work now.

Use flutter pub get --verbose to get more info.

I had the same problem, i did the next
uninstall the android studio, i installed the 4.0.1 version
Also I deleted the flutter sdk and download again in the page official
flutter
Finally i executed the command 'flutter doctor'
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Versión
10.0.18363.1016], locale es-ES)
[√] Android toolchain - develop for Android devices (Android SDK
version 29.0.3) [!] Android Studio (version 4.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality. [!] IntelliJ IDEA Community Edition (version 2019.3)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality. [!] VS Code (version 1.48.1)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 4 categories.
it permits to create a success project

Related

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

when ever I try to run my Flutter program, it gets stuck at “Running Gradle task 'assembleDebug”

whenever I try to run in on an Emulator or on a real device, it get stuck at “Running Gradle task 'assembleDebug” and the entire computer just freezes and get stuck, and the only way out is to hard reboot it.
I'm using an Asus laptop ( windows 10 ), with 16GB ram.
flutter --version gives: (when I try flutter upgrade it gives same result and says I have the latest version)
Flutter 1.20.0-1.0.pre.42 • channel master • https://github.com/flutter/flutter.git
Framework • revision 401690a64f (2 days ago) • 2020-06-12 19:45:48 -0700
Engine • revision 965fbbed17
Tools • Dart 2.9.0 (build 2.9.0-14.0.dev 2b917f5b6a)
when I run flutter doctor I get this output in the terminal: UPDATED
C:\Users\Lidor>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 1.20.0-1.0.pre.42, on Microsoft Windows [Version 10.0.18362.900], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 4.0)
[√] IntelliJ IDEA Community Edition (version 2019.2)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
when I run flutter doctor -v I get this output:
C:\Users\Lidor>flutter doctor -v
[√] Flutter (Channel master, 1.20.0-1.0.pre.42, on Microsoft Windows [Version 10.0.18362.900], locale en-US)
• Flutter version 1.20.0-1.0.pre.42 at D:\Study\P.Languages\Flutter\flutter_windows_v1.7.8+hotfix.4-stable\flutter
• Framework revision 401690a64f (2 days ago), 2020-06-12 19:45:48 -0700
• Engine revision 965fbbed17
• Dart version 2.9.0 (build 2.9.0-14.0.dev 2b917f5b6a)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at D:\Lidor\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
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/docs/get-started/install/windows#android-setup for detailed instructions.
[√] Android Studio (version 4.0)
• Android Studio at D:\Program Files\Android\Android Studio
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] IntelliJ IDEA Community Edition (version 2019.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2
• Flutter plugin version 38.1.4
• Dart plugin version 192.5728.98
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
I also tried to run flutter channel master as it suggested here and also everything here
There are lots of reasons why it's happening: Did not accept android-licenses, incompatible version of sdk/flutter, Windows Firewall etc.
If you haven't tried:
Updated file android/app/build.gradle with
compileSdkVersion 29
Run:
flutter clean
Otherwise check Flutter App stuck at "Running Gradle task 'assembleDebug'... "
Or if your Android license status unknown.
Android Studio installs without sdkmanager
Uncheck Hide Obsolete Packages and you'll see Android SDK Tools (Obsolete) 26.1.1.
and then flutter doctor --android-licenses
in my case I just run flutter upgrade

flutter_pdfview crashing device after opening pdf

I wanted to use flutter_pdfview in an app. During debugging everything worked fine, but once i build the app in Release mode I clicked around in the App and opened some PDF and at some pont a PDF does not load, so i got back to the page before, and at this point the touchscreen of my device does not respond any longer. I tetsted it on two devices with the arm64 version, both devices do not respond any longer at some point. However when I open the App on an armeabi device everything is working fine.
The error is: (Unhandled Exception: PlatformException(error, Neither user 10350 nor current process has android.permission.WAKE_LOCK., null)
I am using flutter_pdfview version 1.0.2+2,
my flutter doctor -v is:
• Flutter version 1.19.0-2.0.pre.142 at C:\flutter\flutter
• Framework revision 721927efd3 (7 days ago), 2020-05-21 17:52:02 -0700
• Engine revision 9ce1e5c5c7
• Dart version 2.9.0 (build 2.9.0-10.0.dev 7706afbcf5)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\Jakob\AppData\Local\Android\sdk
• 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 42.1.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.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.4
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.45.1)
• VS Code at C:\Users\Jakob\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
After some time, I fixed it by adding <uses-permission android:name="android.permission.WAKE_LOCK" /> to AndroidManifest.xml

"flutter run" gets stuck at "Running Gradle task 'assembleDebug"

I updated Flutter to the latest stable version today - 1.12.13+hotfix.7 (I was running 1.12.13+hotfix.6 before). When I tried to run my project in vs code with flutter run it always gets stuck at Running Gradle task 'assembleDebug:
Have anyone experienced the same issue?
Here is the output of flutter doctor -v:
[georgi#georgi-pc Line-up-Generator]$ flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Linux, locale en_GB.UTF-8)
• Flutter version 1.12.13+hotfix.7 at /home/georgi/Development/flutter
• Framework revision 9f5ff2306b (2 weeks ago), 2020-01-26 22:38:26 -0800
• Engine revision a67792536c
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /home/georgi/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.5)
• Android Studio at /opt/android-studio
✗ 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_202-release-1483-b49-5587405)
[✓] Connected device (1 available)
• MI 8 • 62fb6fd8 • android-arm64 • Android 10 (API 29)
! Doctor found issues in 2 categories.
I have to point out that I have tried running flutter doctor --android-licenses but it gets stuck at 25%
Note: I am on Manjaro 18.1.5
UPDATE:
There seems to be an issue with Dart SDK: https://github.com/flutter/flutter/issues/49185#issuecomment-589968058
flutter clean worked for me
I had the same issue. I tried so many solutions and finally found on Github. Try this command in the terminal.
The issue has been resolved upstream. If you want to consume it you will have to switch to the master channel (for now. It will arrive in the stable channel at some point) by running
flutter channel master
After running that, I was able to build my apk just fine on Linux 5.5
I had the same problem and solved it.
I ran flutter doctor --android-licenses as sudo.
I used the whole path, don't know if that's necessary though.
For example I did it like that:
sudo /home/jan/development/languages+devtools/flutter/bin/flutter doctor --android-licenses
After that everything worked.
I tried every answer I found about it, but none of them worked.
Finally I fixed it by deleting the Android Virtual Device I had and creating a new one. In my case looks like it was a problem with the android emulator rather than a flutter bug.

Categories

Resources