No emulators available for cordova - xcode

For some reason I have no emulators available in cordova / ionic.
Cordova:
$ cordova run ios --list
Available ios devices:
Available ios virtual devices:
Ionic:
$ ionic cordova emulate --list
> cordova run --list --emulator
Available ios virtual devices:
I don't understand why this is happening or how to install them. When I open xcode, they are available, but they do not appear in the CLI.

Give this one a try:
cd platforms/ios/cordova && npm install ios-sim#latest

Related

Android studio keeps showing "Loading..." on device selector

I got stuck in this problem for several days, my android studio suddenly keep showing 'Loading...' on its device selector when there are active android emulator or connected to android device.
i use mac os catalina 10.15.5 and here is some clue that might help :
siekoo-mac:~ siekoo$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.5 19F101, locale en-ID)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✗] 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 4.0)
[✓] VS Code (version 1.47.0)
[✓] Connected device (1 available)
siekoo-mac:~ siekoo$ adb devices
List of devices attached
16fb14c20205 device
Ive tried several solutions, like run invalidate & cache restart on android studio, reinstalling adb platform tools, reinstalling android SDKs or even downgrade/upgrade the android studio, all doesnt end with good result. For now, i run my project on android device via terminal
In my case it was due to different compile and target SDK versions inside app level gradle and library gradle. It was resolved by changing sdk versions from 26 to 29 in both.
Open another android project in new window (not a flutter project). Now you have two windows of android studio.
then device will detect on Android project. You will be able to connect your device for native android project. Then try again to detect device on flutter project.
Your device will show here.
This worked for me.
maybe
Open in Android Studio - Preferences | Languages & Frameworks | Flutter
Set path SDK .../SDK/flutter

I cant get my ionic app to open in iOS emulator

My new ionic app won't run in the iOS emulator.
Its a fresh install of ionic and Xcode, these are my steps:
npm install -g ionic
ionic start myApp tabs
ionic cordova platform add ios
ionic cordova build ios
ionic cordova emulate ios
Then I get the following error:
No target specified for emulator. Deploying to undefined simulator
/localhost/myApp/platforms/ios/build/emulator/MyApp.app/Info.plist
file not found.
According to this thread (Fresh Ionic Fails to Emulate iOS 12 - Info.plist file not found) it should work with the following command:
ionic cordova emulate ios -- --buildFlag="-UseModernBuildSystem=0"
But then I get the following error:
No target specified for emulator. Deploying to undefined simulator
Device type "com.apple.CoreSimulator.SimDeviceType.undefined" could not be found.
And then according to this thread (Issues starting iOS simulator from CLI) it should work by updating ios-sim like this:
cd platforms/ios/cordova && npm install ios-sim#latest
But I still get the following error:
No target specified for emulator. Deploying to undefined simulator
Device type "com.apple.CoreSimulator.SimDeviceType.undefined" could not be found.
Ionic:
ionic (Ionic CLI) : 4.10.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : #ionic/angular 4.0.1
#angular-devkit/build-angular : 0.12.4
#angular-devkit/schematics : 7.2.4
#angular/cli : 7.2.4
#ionic/angular-toolkit : 1.4.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : ios 4.5.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 4 other plugins)
System:
ios-deploy : 1.9.4
ios-sim : 7.0.0
NodeJS : v10.15.1 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61
The problem lie with ios-sim package which couldn't detect running simulators.
Updating to 8.0.1 with the following steps resolved the issue for me.
force update ios-sim to a working version
IMPORTANT needs to be done from inside the platforms/ios/cordova directory.
cd platforms/ios/cordova && npm install ios-sim#8.0.1
check if devices are now listed, takes a few seconds
ionic cordova emulate --list
installs appscript if not installed already
ionic cordova build ios
try to deploy to simulator
ionic cordova emulate --release --prod --livereload ios -- --buildFlag="-UseModernBuildSystem=0"
This will find any running simulator and deploy the app
Try just building the project and then running it from Xcode instead first.
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
Then open the platforms/ios folder in Xcode and you'll be able to run it from there plus see any errors there may be with the project. When you eventually decide to push the app to the store you'll need to do this anyway.
EDIT
Then try targeting a specific emulator:
ionic cordova emulate ios --list get list of available targets to copy into the next command.
ionic cordova emulate --livereload ios -- --buildFlag="-UseModernBuildSystem=0" --target="iPhone-X, 12.1" example targeting iPhone XR.
The issue is related to a breaking changes on Xcode 10 not already reflected on ios-sim. You can check on ion-sim repo issue "List empty of devices simulator with Xcode 10".
The issue have already been fixed but is waiting for a new release submission.
You can continue running your App on emulator directly from Xcode.

Titanium CLI choose iPhone type

I'm trying to work with the Titanium CLI (appc). This is what I'm running:
appc run --platform ios --liveview --target simulator --ios-version 9.3 --sim-type iphone --sim-version 9.3 --skip-js-minify
How can I set the specific device to run on (iPhone 4s, 5, 6, 6s, 6s plus ...)? like I choose from Appcelerator Studio?
Also, I'm using Genymotion for Android emulators - I can I use CLI to run on specific emulator?
EDIT
I'm running the following command to run on Android Genymotion emulator:
/usr/local/bin/node /Users/ophir/.appcelerator/install/5.3.0/package/node_modules/titanium/lib/titanium.js build run --platform android --log-level trace --sdk 5.3.0.GA --project-dir /Users/ophir/Documents/Appcelerator_Studio_Workspace/MyApp/App --target emulator --android-sdk /Users/ophir/Library/Android/sdk-titanium --device-id Samsung Galaxy S6 - 6.0.0 - API 23 - 1440x2560 --skip-js-minify --liveview --deploy-type development --no-colors --no-progress-bars --no-prompt --prompt-type socket-bundle --prompt-port 55633 --config-file /var/folders/4x/8mnrwxd51rb3zmn36p6x30w40000gn/T/build-1466517191446.json --no-banner --project-dir /Users/ophir/Documents/Appcelerator_Studio_Workspace/MyApp/App
And I'm getting the following error:
[ERROR] Invalid "--device-id" value "Samsung"
If you want to replicate a studio build, check the console in Studio for the build commmand line that has been generated.
So for iOS the key params are :
build run --platform ios --target simulator --ios-version 9.3 --device-family iphone --sim-type iphone --sim-version 9.3 --device-id XXXXXXXXXXX
you can either cut + paste the UDID of the simulator you are interested in from your studio build, or in Terminal run :
xcrun simctl list
and pick the UDID of the simulator you want.
For Android
build run --platform android --target emulator --device-id 'Google Nexus 5X - 6.0.0 - API 23 - 1080x1920'
Get the emulator name by :
/Applications/Genymotion\ Shell.app/Contents/MacOS/genyshell -c "devices list"
Genymotion shell docs
The only way I can get Titanium to allow me to choose a simulator is by using the following, with two -
ti build -p ios --C
My Titanium version is 5.0.14
try this code
ti build -p ios -C ?

Invalid image path Xcode:7.2.1

I am doing ionic app debugging. After the debug and all. I am trying to release an update to app store, but It works perfectly in iPhone6 emulator. The following errors shows up.
This error shows up when i am trying to add this to app store.
I have already sent few updates before this, and there were not such errors.
Ionic use cordova and since cordova 6.0, there is a bug on the iOS builder 4.1.0.
You can temporally downgrade cordova or iOS builder until this bug will be fixed
to downgrade cordova (and so downgrade iOS builder)
sudo npm uninstall -g
sudo npm install -g cordova#5.4.1
OR
to downgrade only ios
sudo ionic platform rm ios
sudo ionic platform add ios#3.9.2
to check iOS version
sudo ionic platforms
It didn't find any icon for one of the resolutions your app supports
Try by regenerating icons from Ionic CLI:
$ ionic resources --icon
Build again for the iOS plateform
After this make sure there is icons in the resources folder of your app:
ios - App name folder - Resources - icons
Another solutiion try to delete the CFBundleIconFile from the info.plist file : Reference

IOS emulator working app is not installed on it

I have started the IOS emulator through apache cordova CLI and it works, says the build is successful. I can interact with the emulator however my app is not installed on it?
Is there a command that im missing to install my app on this emulated device?
Thanks
To build
cordova build ios
To run in emulator
cordova emulate ios
To run in device
cordova run ios
It might be a bug in Cordova CMD. Try the following commands from your project root directory:
1) cordova build --emulator
2) ios-sim launch platforms/ios/build/emulator/<your_app_name>.app --devicetypeid "com.apple.CoreSimulator.SimDeviceType.iPhone-5s, 8.1"
If you don't have ios-sim install it: npm install -g ios-sim

Resources