Flutter macOS app: Unable to find executable to run - flutter

I have an app that runs perfectly on the iPhone simulator and Chrome. However, when I try to run it as native macOS app, it fails with the below error dump. I tried running flutter clean but no luck. Can anyone please help me with it? Do let me know if I can share any files that can help debug this issue.
% flutter run -d macos
Launching lib/main.dart on macOS in debug mode...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:XYZ-ABC }
{ platform:macOS, name:Any Mac }
Building macOS application...
Unable to find app name. /location/myApp/macos/Flutter/ephemeral/.app_file
name does not exist
Unable to find executable to run
Error launching application on macOS.

Try recreating your macos directory. For example, by running the following bash script from your top-level Flutter project directory.
# Archive macos directory just in-case you want to undo later
mv macos ~/Desktop/
# Recreate macos directory from scratch
flutter create --platforms=macos .
# Try again to run the app on macos
flutter run -d macos

Related

Launch emulator from windows command line receive error G67247B7E

Newbee here. Trying to run the android emulator for the generic first_app flutter application.
Run flutter run -d windows
Receive:
C:\Development\Flutter\first_app>flutter run -d windows
Launching lib\main.dart on Windows in debug mode...
lib/main.dart(60,15): error G67247B7E: Expected ';' after this. [C:\Development\Flutter\first_app\build\windows\flutter\flutter_assemble.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5): error MSB8066: Custom build for 'C:\Development\Flutter\first_app\build\windows\CMakeFiles\13756e3632117b79f6e0bc292bc438e0\flutter_windows.dll.rule;C:\Development\Flutter\first_app\build\windows\CMakeFiles\f154f6c681490929a1ff6491e40cd6b3\flutter_assemble.rule' exited with code 1. [C:\Development\Flutter\first_app\build\windows\flutter\flutter_assemble.vcxproj]
Building Windows application...
Exception: Build process failed.
Other information:
Flutter Doctor is clean. That took hours.
Running from Android Studio works.
Launching emulator works correctly
Have tried Flutter Clean, Flutter upgrade, Flutter Master.
Have tried running from powershell with the same error.
Any assistance welcomed.
First you can check if the emulator is running or not by this command
flutter devices
Then you can directly run your app through
flutter run -d device-id
In my case, it was
flutter run -d emulator-5554
All, on a whim, I deleted my first_app and created it again via flutter create first_app.
Immediately running flutter run, it works!

flutter stuck on Compiling, linking and signing

Flutter project is stuck in Compiling, linking and signing... i dont just understand why this is stuck here...
even using verbose i dont get any stack trace on why this is stuck...
Launching lib/main.dart on iPhone 13 Pro Max in debug mode...
Running pod install... 11.6s
Running Xcode build...
└─Compiling, linking and signing...
The problem should be in the existing project created on previous environment (old versions) and has to be resolved by creating a new one and moving content in.
Move all my custom contents from existing my project (assets, fonts, lib folders and config files...) to this new project and ran the command : the flutter build ios command works well now !
following this : Fixing Xcode 9 issue: "iPhone is busy: Preparing debugger support for iPhone"
I TRIED :
On Xcode:
Go to "Window" -> "Devices and Simulators"
"Unpair iPhone" (on the side list, right clic)
Then:
Unplug and plug again the USB cable
Press Trust in the prompt message in the device
in Flutter Terminal, paste and enter :
flutter clean
flutter pub get
cd ios
pod install --repo-update
cd ..
Then run the app.
==> Worked only 1st time for me.
My work around for launching IOS devices for now:
Each time I want IOS device,
I COPY/ PASTE and press ENTER on the Terminal:
flutter clean
flutter pub get
cd ios
pod install --repo-update
cd ..
flutter run

Error: ADB exited with exit code 1 - remedy?

I am trying to debug a demo app of flutter in vscode where the error is showing for ADB exit with code 1
performing streamed install. I uninstall the existing Flutter demo app.
You should try with these three stuff:
Check out if your emulator memory full.
Check your package name is alright
Clean your flutter and re-run
flutter clean
flutter run
as APK built is Successful there is no issue with the code.
there is something wrong with the device
check u enabled USB debugging
check u enabled install over USB in developer option
few devices don't have to enable install over USB.
then
flutter clean && flutter pub get
uninstall the app in the device and run
flutter run -d <device name>
emphasized text

Ionic emulate Ios fails to run The session does not open my app

Ionic emulate ios failed on Mac OS Yosemite. Their have some cases were the ios device emulated, but shortly after the terminal console shoots up the error message below.
** BUILD SUCCEEDED **
No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (code=146):
Invalid device state
An error was encountered processing the command (code=146):
Exception encountered connecting to CoreSimulatorBridge: Unable to connect to CoreSimulatorBridge
ENOENT, no such file or directory '/Users/yay/Library/Logs/CoreSimulator/2CAA2C39-7F22-4AF2-BBDE-86609188F37C/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/yay/code/myApp/platforms/ios/build/emulator/myApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/yay/code/myApp/platforms/ios/cordova/console.log,--stdout,/Users/yay/code/myApp/platforms/ios/cordova/console.log,--exit
Error: /Users/yay/code/myApp/platforms/ios/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
The issue is because you used sudo to create and/or build the project.
Just input these commands (without the $ of course):
1) Remove with sudo
$ sudo ionic platform remove ios
2) Add iOS back without sudo
$ ionic platform add ios
3) Run iOS emulator
$ ionic emulate ios
Source: https://github.com/driftyco/ionic/issues/4052 (rajkotecha's comment)
Do NOT use sudo when creating or building the project.
Please see https://github.com/driftyco/ionic/issues/4052
I've encountered this issue before, and I believe you messed up with your permission. However, I managed to solve it by reinstall everything from scratch (NOT reformat OS). I suggest you may try to remove all your Xcode, ionic, cordova, and ios-sim content and reinstall again.
Delete your Xcode from your Mac OS.
Remove everything inside:
/usr/local/bin
/usr/local/include
/usr/local/lib/dtrace
/usr/local/share/man/man1
/usr/local/share/systemtap/tapset/
Delete the folder:
/usr/local/lib/node_modules
Once you done the instruction above, kindly use your spotlight to search for keywords such as node, cordova, ionic, etc... to see whether it is still exist or not. Please also ensure yourApp within your Users/username folder is deleted.
You may also try to use your terminal input:
npm -v
cordova -v
ionic -v
It will shows nothing/not found if you've deleted everything completely.
Now you can download and install Xcode from App Store, and wait for Xcode is fully installed in your Mac, then proceed to here to start again your ionic project.
Lastly, once you begin to create an ionic project, by right you no need to use any sudo commands anymore in creating or building this project.
Example:
ionic build ios
Instead of:
sudo ionic build ios
It should be working unless you are not the root user.
Happy coding and have a nice day! :D

how to run apk file in android

I try to run apk file in android, i follow these steps
1. First get the Android SDK and unzip it somewhere on your hard drive
2. Add SDK_ROOT to your system variables pointing to /tools folder under the sdk
3. Run the emulator
4. Copy the apk file to /tools folder
5. Change directory to /tools and run from commandline $adb install your_application.apk 6. Now check applications list in the emulator and you should see the new application installed and ready.
but i get this type of error :
" [2011-01-11 17:02:15 - Logcat]device not found
com.android.ddmlib.AdbCommandRejectedException: device not found
at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:736)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:373)
at com.android.ddmlib.Device.executeShellCommand(Device.java:284)
at com.android.ddmuilib.logcat.LogPanel$3.run(LogPanel.java:527) "
can you help me any one.... ?
Try to start first the emulator. Navigate to the $SDK_ROOT/tools directory and execute the file 'emulator.exe'. Wait couple of minutes until it loads. Now run :
$adb install your_application.apk
If all went without errors then you should be seeing your newly installed APK on the emulator.