Getting cmd: Failure calling service activity: Failed transaction (2147483646) when trying to debug on emulator - flutter

Started getting this error all of a sudden for my Flutter project
Clearing cache did not help.
Rebooting did not help

What fixed it for me is closing the emulator and cold-booting it.

I was having the same issue. Here's what worked for me:
Navigate to AVD folders in file explorer (for me it was ursnm/.android./avd)
Select and delete all files in here,
From Android Studio, go to AVD Manager (should be empty now) and create a new device.
I am very novice, so I have no idea why this worked, but it did for me.
-Brian

Related

Flutter exception while building

I tried to run/debug my application on the desktop (after installing visual studio 2019 with all defaults) but I can't :) and this error occurred:
D:\Visual Studio IDE\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(240,5): error MSB8066: Custom build for 'D:\Location\Some Location\MyFlutterAppLocation\build\windows\CMakeFiles\a50fa560346c71769b697565b5a2d59b\flutter_windows.dll.rule;D:\Location\MyFlutterAppLocation\build\windows\CMakeFiles\eb8cecdef0b53de6eb232004d53dfd8a\flutter_assemble.rule' exited with code 1. [D:\Location\Some Location\MyFlutterAppLocation\build\windows\flutter\flutter_assemble.vcxproj]
Exception: Build process failed.
Few times when I faced a .vcxproj error, I had a previously built .exe process running, even after closing it. I ended the .exe via task manager and the issue was solved. You can spot the running build using the flutter icon or the supplied app icon.
In another instance, I faced a similar error after I interrupted previous flutter run. In this case, I wasn't able to spot the .exe as it wasn't completely built. I don't know which process is specifically using .vcxproj. Hence I resorted to a cleaning of the project:
flutter clean
flutter create --platforms=windows,web,android .
flutter run
Though this second case doesn't pinpoint the source of the error, I was happy to have solved it without restarting VSCode or signing out of windows.

Flutter error: Unable to locate gradlew script

I can't run all of my flutter apps, because in the console appears everytime this error message:
Downloading Gradle Wrapper... 1,2s
Launching lib\main.dart on SM G960F in debug mode...
Running Gradle task 'assembleDebug'...
Finished with error: Unable to locate gradlew script. Please check that C:\Users\...\android\gradlew.bat exists or that C:\Users\...\android can be read.
I try to fix this problem more than ten hours and don't find a solution.
I will advise you to check your pc properly for unwanted programs. Something is preventing your pc from running the Gradle. I had the same issue only to realize that antivirus was installed on my pc alongside a cd burner that I just installed. Check for any antivirus that might be preventing Gradle from running.
I also faced the same error initially. While creating a flutter application from scratch I just ran the default flutter application which is a counter app in a flutter. I faced the same issue at first. If you are in this same context as described earlier the following could be the solution
1.Java 8 is more suitable for the flutter/android development. The next versions of java have some exceptions. I used the Java 14 and stuck at this issue for some time
The next could be the JAVA_HOME path in your environment variables. If it is not provided the set the JAVA_HOME path.
Run flutter --doctor and check the requirements if satisfied like Android SDK is updated or not, upgrade flutter if required. In some cases having good Internet connection also plays a role in this issue some times.
These are the major points to be satisfied in order to get rid of this error. Mostly this could be the a solution or part of it.
The error suggests that something is preventing gradle to run properly on your machine. Check whether you have any unwanted programs or anti-virus on your machine running that might be preventing gradle to run. If so, remove or stop those programs / anti-virus and try again.
After that, delete the .gradle folder located here C:\Users\yourPcName\.gradle containing the unfinished file and try again . It will work now .
You can also manually download Gradle and map it in Android studio , Learn more with this article here .
Warning, the gradle versions change quickly, so make sure you manually
downloaded the exact version that flutter wanted to download and the
download failed. Download the gradle here and then replace it in the
gradle folder.
C:\Users\yourPcName\.gradle\wrapper\dists\gradle-x.x.x-all
If it still doesn't work,
Try to run flutter --doctor
From a console window that has the Flutter directory in the path (see above), run the following command to see if there are any platform dependencies you need to complete the setup:
C:\src\flutter> : flutter doctor
This command checks your environment and displays a report of the status of your Flutter installation. Check the output carefully for other software you might need to install or further tasks to perform (shown in bold text).
You can learn more here :
If flutter doctor itself doesn't work, then know that flutter is not installed on your machine (or you forgot to add it to the environment
variable).
I also faced this problem and I made something to run my app on android
tried to open anything on android files and android studio ask me if I want to open for editing android file in android studio then click on it and it will open android project then click run enter image description here

Getting Flutter doctor to work

How do I get flutter doctor on my Windows 10 laptop to work, please?
I followed the guidelines here,
Used git to clone the flutter repository,
git clone -b alpha https://github.com/flutter/flutter.git,
Tried adding "C:\Users\<user>\flutter\bin" to my path in the Control Panel
and then in an Admin Powershell, tried executing flutter doctor.
At first, it just hung.
After googling for help, I tried deleting the contents of the
C:\Users\<user>\flutter\bin\cache folder and re-executing flutter doctor but to no avail.
Then, I tried deleting all of flutter and cloning again but flutter doctor just hung again but with, Updating flutter tool.
Tried a few different Googled PATH-adding ideas (that seems to be a complex and disputed area.)
Got a new message: Waiting for another flutter command to release the startuplock
The latest state is that flutter doctor still just hangs but without any message.
I suspect the problem lies in the new Path not being properly recognised (in the registers??)
Can anyone help please?
Well, the issue is not clear enough, but this might be solution, if your flutter doctor is stuck, it might be due to Background Intelligent Transfer Service is disabled, in order to check for yourself, do the following:
Click on the start menu, and then start typing services.
Launch the services and look for Background Intelligent Transfer Service and make sure it is running.
At this stage I believe you will find it disabled for some reason, just right click on it and go to properties and start the service, also change the startup type to automatic.
I can not think of other reasons that might prevent flutter doctor to run for the first time on a Windows machine other than that honestly.
I know this question is a little bit old. Here is a solution that worked for me. Run the Command Prompt as an admin solved the issue for me.
For Windows user check to see if the unzipped flutter folder is read only. (i.e right click the folder then properties then in the attributes section untick the readonly property then apply this change to the folder along with the sub-folders then ok and thats it. Worked for me.
Some errors I got and how I fixed it:
(ERROR 1):
[flutter] flutter doctor -v 'crumb' is not recognized as an internal or external command, operable program or batch file.
Error: Unable to find git in your PATH. exit code 1
(Fix) - Go to flutter installation folder and inside flutter/bin edit the flutter.bat file using a text editor and remove the line (20) that says:
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
The code should look like this on those lines:
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
Save and Run flutter doctor and everything should work fine.
(ERROR 2):
flutter doctor takes too long
(Fix) - I downloaded the previous version of the sdk it worked like a charm.
(ERROR 3):
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.
(Fix):
Open Android Studio
Tools Menu, SDK Manager
In the window that comes up there are inner panels, choose SDK Tools panel
Tick Android SDK Command-line Tools
Choose Apply button near the bottom of the window
This worked.
(ERROR 4):
The term 'flutter' is not recognized as the name of a cmdlet, function, script file, or operable program.
(Fix) - Put the correct part in the env variables. I had put D:\flutter instead of D:\flutter\bin. That worked.
I got a solution that worked for me
initially i had downloaded the 2.2.5 SDK which gave the forever run error so i went back and downloaded the previous version ie 2.2.2 it worked like a charm
The Flutter SDK is installed in a protected folder and may not function correctly. Please move the SDK to a location that is user-writable without Administration permissions and restart.

Issue while launching project in device

I am facing a weird issue while running my project on the device. I see below error even though the app file is present in the mentioned path. Also the project gets copied in the device & I need to tap on app icon to launch it but it fails while launching from XCODe. Any clue - is this because of spaces in my schema name?:
error: failed to launch '/Users/abhi/Library/Developer/Xcode/DerivedData/MyProject-atlkwwnwccqaopgembmyzeecthfx/Build/Products/QA - Debug - Production-iphoneos/MyProject.app/MyProject' -- No such file or directory (/Users/abhi/Library/Developer/Xcode/DerivedData/MyProject-atlkwwnwccqaopgembmyzeecthfx/Build/Products/QA - Debug - Production-iphoneos/MyProject.app/MyProject)
Delete app from your device, switch OFF and ON your device, clean your code and then run it on device, it will install..
If not Restart your Xcode...
I have tried this when i have faced same problem and this one worked for me
Tried advice by Sree Charan with no success for XCode 4.3.3. Ultimately (and I'm not sure this is what fixed it), I went to Validate Settings on the Editor Menu and it updated settings from GDB to LLDB and then it worked.
I'm only providing the info above in hopes it might help someone else. I have no way to verify that is what fixed this problem (and I spent 2 hours looking for a solution).

Waiting for HOME ('android.process.acore') to be launched

I tried working the Hello World application and the emulator freezes after it flashes the Android start screen. The home page is not shown. The last display on the console is
Waiting for HOME ('android.process.acore') to be launched...
I tried reinstalling Eclipse and Android again. It still did not work. Also the console does not show any errors. The log cat has the following errors:
06-18 20:39:11.543: ERROR/flash_image(544): can't find recovery partition
06-18 20:39:11.843: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
06-18 20:39:11.843: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test2' (m)
06-18 20:39:11.843: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
06-18 20:39:11.843: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test' (m)
06-18 20:46:31.842: ERROR/MemoryHeapBase(578): error opening /dev/pmem: No such file or directory
06-18 20:46:31.892: ERROR/SurfaceFlinger(578): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
06-18 20:46:32.313: ERROR/GLLogger(578): couldn't load library (Cannot find library)
06-18 20:46:33.634: ERROR/GLLogger(578): couldn't load library (Cannot find library)
The solution which worked for me is, when you get the message:
Waiting for HOME ('android.process.acore') to be launched...
Wait for few seconds and then right click on the project and click run as Android application once again.
I faced the same problem. However, it worked after i went to Project->Clean...
Don't know why it happened though.
Hope this helps
I get this problem all the time and have lost many hours of potential productivity and education while I try to fix it. The only thing that works for me is the combination of three other good answers:
Project -> Clean
Delete all the AVDs and create new ones
If an attempt to run still hangs too long on 'Waiting for HOME' (over two minutes) or the emulator keeps rebooting every minute or so, try Run as Android App several times, choosing the same existing emulator instance (I always choose runs manually).
It's odd that no one has a clue why this problem comes up, what causes it or what is going on internally. The only clue I can supply is that DDMS shows a few lines like "Class not found for preloading: libcore.base.CollectionUtils" during the 'Waiting for HOME' pause.
What worked for me was to delete the AVD from the AVD manager and create a new one. Then go to
Run >Run Configurations, select the target tab and choose the new AVD.
Following steps worked for me:
1. Goto Project -> Clean.
2. Delete your previous AVD and create a new one.
This problem occurs because while creating the AVD manager in the "Create new Android virtual device(AVD)" dialog window ,"Snapshot" was marked as "Enabled" by me.
Solution:
Create a new AVD manager with the "Enabled" checkbox not checked and then try running the project with the newly created AVD manager as "Target" , the problem will not occur anymore
I solved this issue by creating a new virtual device and launching it from the AVD manager. The device takes a few minutes to start, you just have to wait. Then you can run your application on the already started device.
Options:
Click on the HOME Button on the Emulator. Wait for may be 2
seconds....
This always works for me!!!
or
Go with Shreya's suggestion (one with most suggestions and edited by
Gray).
I had only 12 Mb for the SD Card in the AVD device.
Increasing it to 2 Gb solved the issue.
SOLUTION:
Run the emulator from the command line:
sdk/tools> ./emulator-x86 -avd <DeviceName> -partition-size 1024 -gpu on
Then I launched the app from the command line as well (using built-in Cordova/PhoneGap tools):
myapp/cordova> ./run
BACKGROUND
I believe this is some sort of hardware compatibility issue. I came across this problem when following the PhoneGap 2.4.0 Getting Started Instructions. I followed their advice to install the Intel Hardware Accelerated Execution Manager, and I think this is the source of my trouble. Eclipse uses the emulator64-x86 program (in the sdk/tools folder) to launch the emulator. I could not find any way inside of Eclipse to change this but I found by following the "Tips & Tricks" section of the Intel HAXM web page that I could get the emulator to run successfully from the command line by using the emulator-x86 program instead. I'm not sure why the emulator64-x86 program doesn't work on my system. I confirmed at the Apple website that I do have a 64-bit processor.
My system:
OSX 10.6.8
2x2.26 GHx Quad-core Intel Xeon
6 GB RAM
ADT v21.1.0-569685
Eclipse 3.8.0
My AVD:
Device: Nexus One
Target: Android 4.2.2 - API Level 17
CPU: Intel Atom (x86)
RAM: 512
Internal Storage: 256
SD Card: 128
I created a new device. Deleted the previous one.
None of these solutions worked for me. Instead, what worked was to go to a command line tool (or terminal in Mac), CD into the SDK/platform-tools directory, and then run this:
adb kill-server
then run this:
adb start-server
After I did this everything worked again. Why? Who knows.
On my MAC the path to the platform-tools folder was $HOME/Installations/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
It will probably be somewhere else on your machine.
I also found this page that presents some helpful steps:
http://android.okhelp.cz/android-emulator-wont-run-application-started-from-eclipse/
What worked for me was enabling the checkbox "Use Host GPU" when creating or editing the AVD (Android Virtual Device). This checkbox was not enabled by default.
It worked for me when I selected 'Use Host GPU' option under 'Emulation Options:'.
You can find the option under Edit window of the virtual device.
I increased the virtual device SD card size from 500MB to 2GiB, the problem solved.
Following steps worked for me: 1. Goto Project -> Clean. 2. Delete your previous AVD and create a new one.
I noticed this is an old post. However I just ran into the same problem and found a solution. A) Make sure you have the CPU/ABI is atom
B)Ram is 2048
C)VM Heap is 256
D)Internal Storage is 200
E)Make sure to check the Use Host GPU
F)Device is Nexus 5 (My personal choice)
G)Android 4.4.2 API Level 19