Flutter error: Lost connection to device. How to solve it? - android

I have this error that I've been stuck with for months. I have no idea what's causing it or how to go about solving it. Somehow it won't connect with the emulator. It's either this or "Error connecting to service protocol".
The error below:
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Warning: This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
√ Built build\app\outputs\flutter-apk\app-debug.apk.
W/FlutterActivityAndFragmentDelegate( 5440): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
D/FlutterLocationService( 5440): Creating service.
D/FlutterLocationService( 5440): Binding to location service.
Lost connection to device.
What I've checked so far:
Memory is enough
flutter doctor -v shows no issues

Related

Cannot run Flutter project in Android Studio while using Android Virtual Device (AVD)

I am a newbie at StackOverflow so if I made some mistakes, I am very sorry, and please correct me.
So I am currently learning Flutter in Android Studio.
Before I go on, I need to inform you that somehow my Windows 10 cannot download properly after being updated. For instance, when I am downloading UnitySetup64.exe, the download was disconnected suddenly and tells "could not download properly".
The same thing when I was downloading Unity Editor from Unity Hub (yes, I also make video games, sorry this a bit out of context, just describing what happened to me overall). So, I cannot download Unity Editor from Unity Hub.
This also affects Android Studio. I could not download SDKs etc. from Android Studio smoothly. Then, I managed to download (maybe) most of the essential kinds of stuff to develop the Flutter project in Android Studio (means I succeeded in downloading SDKs, etc.) by repeatedly trying to download things until the download reached 100%.
I also made sure that there is no trouble in Flutter, by running flutter doctor -v. It is said that there is no problem on Flutter at all.
However, when I tried to run my project using Android Virtual Device, the console shows this:
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
Exception in thread "main" javax.net.ssl.SSLException: Tag mismatch!
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:133)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:326)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:269)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:122)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1406)
at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1371)
at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:958)
at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:290)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
at java.base/sun.net.www.MeteredStream.read(MeteredStream.java:134)
at java.base/java.io.FilterInputStream.read(FilterInputStream.java:133)
at java.base/sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3510)
at java.base/sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3503)
at org.gradle.wrapper.Download.downloadInternal(Download.java:62)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.wrapper.Install$1.call(Install.java:61)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
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)
Caused by: javax.crypto.AEADBadTagException: Tag mismatch!
at java.base/com.sun.crypto.provider.GaloisCounterMode.decryptFinal(GaloisCounterMode.java:623)
at java.base/com.sun.crypto.provider.CipherCore.finalNoPadding(CipherCore.java:1116)
at java.base/com.sun.crypto.provider.CipherCore.fillOutputBuffer(CipherCore.java:1053)
at java.base/com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:941)
at java.base/com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:491)
at java.base/javax.crypto.CipherSpi.bufferCrypt(CipherSpi.java:779)
at java.base/javax.crypto.CipherSpi.engineDoFinal(CipherSpi.java:730)
at java.base/javax.crypto.Cipher.doFinal(Cipher.java:2497)
at java.base/sun.security.ssl.SSLCipher$T12GcmReadCipherGenerator$GcmReadCipher.decrypt(SSLCipher.java:1629)
at java.base/sun.security.ssl.SSLSocketInputRecord.decodeInputRecord(SSLSocketInputRecord.java:260)
at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:181)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:110)
... 17 more
Exception: Gradle task assembleDebug failed with exit code 1
Any suggestion or help is highly appreciated since I do not know what to check or download anymore to make my project running with the AVD.

Android emulator version 30.5.4.0 mac os issues

I'm trying to run android emulator, but instead of success I'm getting errors and lagged ui
Errors:
handleCpuAcceleration: feature check for hvf
cannot add library /Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
added library /Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
cannot add library /Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libMoltenVK.dylib: failed
HVF error: HV_ERROR
qemu-system-x86_64: failed to initialize HVF: Invalid argument
Failed to open the hax module
No accelerator found.
qemu-system-x86_64: failed to initialize HAX: Operation not supported by device
added library /Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib
I've already tried everything recommended steps from this post
Android Emulator 30.4.5 not working on MacOS
and from the other relative posts on stackoverflow and google search results, haven't succeed yet.
Mac OS Big Sur 11.2.3
For me worked a solution from this answer.
You have to download the emulator from the google repository https://dl.google.com/android/repository/emulator-darwin-6885378.zip and replace the one you have already installed, with the downloaded one.
If you have file quarantine enabled, as I did, you have to remove it from downloaded files:
xattr -r -d com.apple.quarantine /path/to/dir
After this, your emulator should work properly.
It looks like emulator update revision: 30.5.6 has solved this issue.

Flutter build apk and installed got flash blank screen

when I build the flutter app and install on the real android phone I got these errors.
Launching lib/src/config/flavors/main_stage.dart on DUB AL00 in debug mode...
✓ Built build/app/outputs/apk/debug/app-debug.apk.
E/flutter (32542): [ERROR:flutter/shell/gpu/gpu_surface_gl.cc(70)] Failed to setup Skia Gr context.
Error connecting to the service protocol: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:52745/fiENvL9drJE=/ws
Exited (sigterm)
I googled there are saying add --enable-software-rendering , this works with debug mode
but how can I make work when I build an installable APK? If I run as relase mode this argument does not work.
anyone can help? thanks
flutter run --enable-software-rendering should work as a work-around. CC #mit-mit, #cbracken #chinmaygarde I thought that we had decided to make Android Emulators default to software rendering? (I can't seem to find the issue tracking that)?
source
Run > Edit Config > Additional Argument > "--enable-software-rendering"

Android Studio Blank Activity Compilation Fails

I have been coding for a few years now and decided it was time to sink my teeth into android development. So I downloaded the latest version of Android Studio and installed all the relevant components with the installer.
However when i try to create a new project, using the blank activity, without even changing a single line of code, or editing the project in any way, the compile fails with the below error:
android execution failed for task :app:packageDebug
> Implementing Class
I have no idea of to fix this, any help would be greatly appreciated.
Thanks
I have been having the same error message. This is what I have found out:
I have a Mac Book Air with a Custom OS Image installed (from work) and on this computer I see the same error message above even from a fresh install (custom image) and fresh install of JavaRE and JDK as per the Android Studio System Requirements. Also a fresh install of Android Studio using a Blank activity with no additional lines of code.
However, I reinstalled OS X 10.10 from scratch, straight from the App store, with no OS customizations, installed the same JavaRE, JDK and Android Studio and the Error message did not appear.
I have been scratching my head over this error for a while now and this is the only solution that I have found. I'll keep digging and report back if I find a better solution.

Titanium Studio: Application Installer abnormal process termination. Process exit value was 1

I've tried running a proyect on Titanium Studio along with Genymotion following these guides:
http://docs.appcelerator.com/titanium/3.0/#!/guide/Setting_up_Studio(For Titanium Studio, I tried it by pre-installing the prerequisites before Titanium Studio's installation, and by letting it automatically install them)
https://wiki.appcelerator.org/display/guides2/Installing+Genymotion(For Genymotion)
I installed the Android SDK's via Titanium Studio(I've tried different combinations).
I've tried running a proyect that is error free(the whole team can run it perfectly) and also I've tried running the default classic proyect on Ti Studio, and also the Alloy default template.
But whenever I run it, I get this message:
[ERROR] Application Installer abnormal process termination. Process exit value was 1
[ERROR] : Failed to package application:
Every single time. I've tried installing in different ways, different combinations and yet I've been unable to resolve this issue.
I've also researched online but I haven't found a solution yet, I've been stuck with this for 3 days. I also installed it on two different OS(windows 7 and windows 8) with two different laptops. The windows 7 had an issue with an AV that didn't add the path to the PATH environment variable. That has been solved, but I'm still with this problem.
Here's the full log(it's short) running on Trace level:
http://pastecode.org/index.php/view/55798735
Any help would be appreciated
Already solved it. It was that the latest build tools apparently had no compatibility with Titanium so I had to uninstall it and install a previous build tool. This is the link where I saw it: developer.appcelerator.com/question/178514

Categories

Resources