ionic emulators config - mdublin/mdublin.github.io GitHub Wiki
ios
Had to run this first:
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Then in Ionic project, this should work:
$ ionic cordova emulate ios
Android
*to check platform versions: $ cordova platform ls
(in onpoint):
$ ionic cordova platform update android or $ ionic platform update [email protected]
$ ionic cordova build android
For fresh install of latest version of Android Studio (v2.2.3):
To avoid a range of Android SDK errors (e.g. no gradle wrapper, missing license, version issues, etc) when running $ ionic cordova emulate android, I did the following:
-
After standard install, open Anroid Studio —> * Configure menu —> SDK Manager —> Just to be safe, I installed both O and Nougat SDK Platforms.
-
Might also need to update JDK to 8.0, got dmg here
-
(this resolved gradle wrapper issue) apparently
templatesdirectory in~/Library/Android/sdk/toolswas missing, so I downloaded the Android SDK tools package and just copied the entiretemplatesdirectory fromtoolsinto thetoolsdirectory that was already installed at~/Library/Android/sdk/tools -
a JS error was happening emanating from
emulator.jsinonpoint/platforms/android/cordova/libon line 202 which I was able to silence by commenting out:var num = target.split('(API level ')[1].replace(')', '');
and replacing with:
var num = target.match(/\d+/)[0];
NOW, in order to run the emulator smoothly (e.g. native map app/GPS will load but seems to stall unless you already have Android Studio open and running before you call the emulator from ionic), you have to actually start a virtual device in Android Studio first:
- Create a project.
- Open project and click AVD Manager button inside project to open virtual device manager.
- Select or Add a virtual device manager and click on green arrow in Actions to start virtual device.
Next, back over to Ionic project:
$ ionic cordova emulate android
For thorough uninstall of current Android SDK if need be:
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
rm -Rf ~/Library/Caches/AndroidStudio*
if you would like to delete all projects:
rm -Rf ~/AndroidStudioProjects
to remove gradle related files (caches & wrapper)
rm -Rf ~/.gradle
use the below command to delete all Android Virtual Devices(AVDs) and *.keystore. note: this folder is used by others Android IDE as well, so if you still using other IDE you may not want to delete this folder)
rm -Rf ~/.android
to delete Android SDK tools
rm -Rf ~/Library/Android*