Flutter error when lauching application on physical device - android

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!

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

My flutter app is getting stuck at "Installing build\app\outputs\apk\app.apk..." and then nothing happens

As i mentioned in the question,i cannot see anything in the console but Installing build\app\outputs\apk\app.apk... and i just cannot understand the reason because my app is working in the device. I can change the pages but the little informations that i want to see, the prints that i entered in the code are not visible and its very annoying.
Before asking here i have been looking the other questions about this problem but the answers in that questions did not worked for me so i end up asking this in here, i hope you can help me.
here is the console after i click the run button;
Launching lib\main.dart on LG H850 in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
an here is the flutter doctor
[√] Flutter (Channel stable, v1.17.0, on Microsoft Windows [Version 10.0.18362.778], locale tr-TR)
• Flutter version 1.17.0 at C:\Users\Mahir Yakup Şahin\flutter
• Framework revision e6b34c2b5c (8 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 29.0.2)
• Android SDK at C:\src\Android
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\src\Android
• 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)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.45.0)
• VS Code at C:\Users\Mahir Yakup Şahin\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.10.1
[√] Connected device (1 available)
• LG H850 • LGH850b31f3def • android-arm64 • Android 8.0.0 (API 26)
• No issues found!
I will be very grateful for any kind of help.
And also i tried in the vscode as well, here is the result,
enter image description here
and sometimes i get an error like this;
enter image description here
Try "flutter clean", that helps in lot many cases..seems like yours is also one of those..
Also..make sure that you have enough storage space on your device (phone or emulator, whatever you re using)..the description on the second image seems like because of the storage issue.

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 .

visual studio can't create an emulator for flutter applications

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

Categories

Resources