visual studio can't create an emulator for flutter applications - android

I am currently trying to run a flutter application in visual studio.
I have successfully installed android studio with some system images.
the virtual machines are successfully created in android studio.
But unfortunately those devices couldn't be detected in visual studio
And when i tried to create a new emulator in visual studio it gives this message.
Warning: Observed package id 'system-images;android-28;google_apis_playstore;x86' in inconsistent location '/usr/lib/android-sdk/system-images/android-28/google_apis/x86' (Expected '/usr/lib/android-sdk/system-images/android-28/google_apis_playstore/x86')Error: AVD not created.
so I tried to change the directory of the system image from /usr/lib/....... /google_api_playstore/x86 but it gives the same error message.
I want to note that when I use directly my phone in debugging mode. it gives this message
Launching lib/main.dart on PGN518 in debug mode...
ProcessException: Process "/home/osema/dev/android/myApps/lastapp/android/gradlew" exited abnormally:
Exception in thread "main" java.io.FileNotFoundException: /home/osema/.gradle/wrapper/dists/gradle-4.10.2-all/9fahxiiecdb76a5g3aw9oi8rv/gradle-4.10.2-all.zip.lck (Permission denied)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:49)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Command: /home/osema/dev/android/myApps/lastapp/android/gradlew -v
Exited (sigterm)
the output of flutter doctor -v
[✓] Flutter (Channel stable, v1.0.0, on Linux, locale en_US.UTF-8)
• Flutter version 1.0.0 at /home/osema/dev/android/flutter
• Framework revision 5391447fae (2 months 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 /usr/lib/android-sdk/
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /usr/lib/android-sdk
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] Android Studio (version 3.2)
• Android Studio at /opt/android-studio
• Flutter plugin version 31.3.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] VS Code (version 1.30.2)
• VS Code at /usr/share/code
• Flutter extension version 2.22.3
[✓] Connected device (1 available)
• PGN518 • SG8HYDG6G66DRSPR • android-arm • Android 5.1 (API 22)

Solution:
Open C:\Users\YourUserName.android\avd\ and delete flutter_emulator.avd folder completely
Then go VS Code -> Devices -> Create New Android Device

Related

Flutter release apk crash on launch

I am having an issue testing a release build on my device. If I use the app using flutter run or flutter run --release, the app runs with no errors reported and I can use the app without issue. However, using the generated APK from flutter build apk, the app crashes immediately stating the app failed to launch.
I have followed everything from here https://flutter.dev/docs/deployment/android#building-the-app-for-release so that shouldn't be the issue.
How do I begin to debug this issue?
This is the output from Flutter Doctor -v
[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.7 19H2, locale en-GB)
• Flutter version 1.20.4 at /Users/student/flutter
• Framework revision fba99f6cf9 (3 weeks 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 /Users/student/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• 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-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.0.1, Build version 12A7300
• CocoaPods version 1.9.1
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.49.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.15.0
With release mode. You can debug what's going on with https://fbflipper.com. Just download Flipper tool, install and run it and watch the logs.
Anyway, you can consider my points about android crash:
Wrong arch: check architecture supported between apk and device
Check broken in native libraries or class not found: Some libraries broken reference in release with ProGuard
Manifest broken: Some thing kind of missing or incorrect in configuration of manifest file

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 release APK build - Intermittent white screen

My app works perfectly on the Android emulator. When I create a release APK I get this error:
Intermittently, the Scaffold content does not load. The Nav bar and drawer are visible, but not the central content.
This does not happen every time I open the app, only about 1/3 times, on average. There is no obvious pattern to this working or failing.
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.11.6 15G22010,
locale en)
• Flutter version 1.12.13+hotfix.7 at /Applications/flutter
• Framework revision 9f5ff2306b (3 days 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 28.0.3)
• Android SDK at /Users/dan/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS
development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin
code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install:
sudo gem install cocoapods
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.41.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.1
[✓] Connected device (1 available)
• klte • 5d3f96b0 • android-arm • Android 7.1.2 (API 25)
I have a similar case, the scaffold is not drawn, it is as if it were empty, for the moment the solution I found was to generate the apk but in debug mode, change flutter build apk --release to flutter build --debug .

Android device not getting recognized by adb manager in Ubuntu OS(Emulator is recognized)

I am trying to work on flutter . Flutter doctor is not detecting my Android device.But it is detecting the Android emulator.
I am using brand new Redmi Note 7 with developer options on.
UBUNTU 18.04 OS
1) Tried with all three USB options
Use USB for
No Data transfer
File Transfer
Transfer Photos (PTP)
2) when I check with adb devices
The device is not getting detected
adb devices
I am working on Flutter Flutter doctor is not recognising my android device. I am using brand new Redmi Note 7 for testing
krishvek#krishvek-Inspiron-N4030:~$ flutter doctor -v
[✓] Flutter (Channel stable, v1.2.1, on Linux, locale en_IN)
• Flutter version 1.2.1 at /home/krishvek/flutter_dev/flutter
• Framework revision 8661d8aecd (7 weeks ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/krishvek/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /home/krishvek/Desktop/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 /home/krishvek/Desktop/android-studio
• Flutter plugin version 34.0.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] IntelliJ IDEA Community Edition (version 2019.1)
• IntelliJ at /home/krishvek/intellJ/idea-IC-191.6183.87
• Flutter plugin version 34.0.4
• Dart plugin version 191.6183.88
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
krishvek#krishvek-Inspiron-N4030:~$ adb devices
List of devices attached
adb server version (40) doesn't match this client (36); killing...
* daemon started successfully *
krishvek#krishvek-Inspiron-N4030:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/krishvek/flutter_dev/flutter/bin:/home/krishvek/Android/sdk/platform-tools:/home/krishvek/Android/sdk/platform-tools/:/home/krishvek/Android/sdk/platform-tools:/home/krishvek/Android/sdk/platform-tools/
It should recognize android device

Flutter error when lauching application on physical device

everyone.
I've installed the Flutter and I got a problem when I launch a simple application on my device.
I did from the Visual Studio Code, but didn't work. So I executed from the command line with flutter run and also didn't work. There is the output:
Launching lib/main.dart on XT1069 in debug mode...
Initializing gradle... 6.2s
Resolving dependencies... 4.5s
Gradle task 'assembleDebug'...
Gradle task 'assembleDebug'... Done 11.6s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk... 5.0s
Error: ADB exited with exit code 1
Error launching application on XT1069.
I also tried the command flutter clean before run. No success.
The flutter doctor full log:
[✓] Flutter (Channel beta, v0.9.4, on Linux, locale en_US.UTF-8)
• Flutter version 0.9.4 at /home/valdinei/dev/flutter
• Framework revision f37c235c32 (4 weeks ago), 2018-09-25 17:45:40 -0400
• Engine revision 74625aed32
• Dart version 2.1.0-dev.5.0.flutter-a2eb050044
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /home/valdinei/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /home/valdinei/dev/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] Android Studio (version 3.2)
• Android Studio at /home/valdinei/dev/android-studio
• Flutter plugin version 29.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] VS Code (version 1.28.2)
• VS Code at /usr/share/code
• Flutter extension version 2.19.0
[✓] Connected devices (1 available)
• XT1069 • 0013848438 • android-arm • Android 6.0 (API 23)
• No issues found!
PS: My device is already on debug mode and the screen even "wake up" when I try the command to run.
My application is the default that came when I created the project.
OS: Linux Mint 18.3
I hope you can help me. Thanks!

Categories

Resources