Problem Statement
When I try to do ng s -o in my terminal for my Angular app, it says, "How would you like to open this?" inside a popup box where I can choose an app, but choosing an app doesn't work.
Image of Problem
When I try to choose an app, it displays code. When I chose Chrome in the popup box, this happens:
The image shows that when I run an app after ng s -o it just displays code. Also, the tab title in the browser says "ng" when the code shows. Another thing, there is no error in the terminal...
Expected Results
I want to run my Angular app with ng s -o.
Actual Results
The app doesn't serve and asks to open an app.
Note: I am using Visual Studio Code for this.
The problem was related to my cli. I was using PowerShell when I was running ng, and for some strange reason, PowerShell stopped running ng and was asking me to open an app to run the file. Even though this never happened to me before and I was using ng and PowerShell just fine before. Strange!
Now I am using CMD instead. It now runs perfectly. So, I switched cli's from PowerShell to CMD in my integrated terminal in Visual Studio Code and it started working.
I got the idea to switch cli's from this: https://github.com/Microsoft/vscode/issues/28541
npx ng serve -o works for me in visual studio code.
The problem was caused as the Vs code was using PowerShell mode. By changing it to default cmd mode, the ng commands started to work.
The steps to change from PowerShell to cmd mode is as follows:
Press Ctrl + Shift + P to show all commands.
Type profile in the displayed text box to filter the list.
Select Terminal: Select Default Profile.
You will be prompted to select your preferred terminal shell, you can change this later in your settings or follow the same process as we do now.
I downloaded the latest titanium extension for the vs-code on Mac.
Steps :
Focus on Titanium command view
Click on Set log level
Set log level to Trace
Run the project
The command that extension fires in the terminal doesn't contain any log level.
appc run --platform ios --target simulator --device-id 1865408B-87E0-4ABC-9DAC-5737385D3165
Try setting the global log-level with ti config:
appc ti config cli.logLevel trace
https://wiki.appcelerator.org/display/guides2/Titanium+CLI+Options#TitaniumCLIOptions-cli.logLevel
I’ve a very strange problem from some days…
I’m working on a Ionic 3 Angular 5 app
I make some changes on code, save it and run:
npm i
ionic cordova run browser -lc
Looking log on terminal i see that it’s running a previous code
I’ve tried to delete npm cache, close terminal or vs.code but nothing
Someone has same problem ?
Some help ?
It's strange, but try deleting the folder www or use ionic serve.
I am using Genymotion for running android application.
Could any one tell me how to capture screen shot in Genymotion ?
If you are using Android Studio or Eclipse, you can just click the button "Screen Capture" in the Android DDMS:
You can use adb to get the screenshot from command line:
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png
This article has the details:
http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html
To make my life easier, I made an alias in .bash_profile:
alias screenshot="adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > ~/Downloads/android_screenshot.png"
Now I can type screenshot in Terminal and get a screenshot of currently running emulator in my Downloads directory.
Disclaimer : I'm part of the same company as the Genymotion team.
This feature is included in the product. It is one of the paid feature of the screencast widget. Look at the pricing page here.
Two ways to access it:
pay for the pro or indie licence
use the trial version, it offers you the indie features. Be careful, there is only one trial day left :-/
Once your VM is started, open the screencast widget
Then take a picture with the dedicated button
UPDATE: You have bellow another ways to take a screenshot using Android Device Monitor or the command line
Use this commands:
Windows:
C:\"Program Files"\Genymobile\Genymotion\tools\adb shell screencap -p "/mnt/sdcard/output.png" && C:\"Program Files"\Genymobile\Genymotion\tools\adb pull "/mnt/sdcard/output.png" "C:\output.png" && C:\"Program Files"\Genymobile\Genymotion\tools\adb shell rm "/mnt/sdcard/output.png"
Note: Make sure you have permission to write to C:\output.png; otherwise, change it to whatever path you like.
OS X:
/Applications/Genymotion.app/Contents/MacOS/tools/adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > ~/Desktop/Android_Screenshot_$(date +%Y-%m-%d-%H-%M-%S).png
Select genymotion simulator
Hit shortcut key describe below
Windows : Ctrl+Shift+S
Mac : Cmd+Shift+S
You can find your screenshots at desktop
I think you can also take videos for free. Genymotion uses VirtualBox to do almost all the heavy lifting, so you should open VirtualBox and look at what you can do in it.
You will find options in Virtualbox to capture video!
adb shell screencap -p /sdcard/screen.png
If your Mac is slow and you hate running Eclipse and the emulator together here is a quicker way.
Export your apk.
Start Genymotion.
Drag the apk to the emulator, in order to install it.
Go to 'android-sdk-macosx>tools>ddms'.
Run that file.
A new instance of ddms will be started. Unlike Eclipse, it doesn't slow down your system.
Use the 'Menu>Device>Screenshot' option to take screenshot.
This is a good option for those using slow computers.
If you are using Eclipse, then follow the steps for any type of emulator:
1. Select DDMS
2. In Devices window of DDMS select Genymotion device
3. Click on Camera icon then save it to specific location.
For Linux and Windows (I used gitbash on windows)
adb shell screencap -p | sed 's/\r$//' > screen.png
For Mac
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png
#Reck says there's a bug in the Genymotion implementation so we can't take screenshots on 2.3.7. This means that Android Studio / DDMS can't get the proper pixels. adb shell screencap says there's no screencap command.
Assuming you have access to the code you can simply call this method:
public static void screenshot(View view) {
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
view.draw(new Canvas(bitmap));
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
try {
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
storageDir.mkdirs();
File file = File.createTempFile(timeStamp, ".png", storageDir);
bitmap.compress(Bitmap.CompressFormat.PNG, 0, new FileOutputStream(file));
Log.i("SCREENSHOT", "adb pull " + file);
} catch (IOException e) {
Log.e("SCREENSHOT", "Cannot save screenshot of " + view, e);
}
}
In Activity:
screenshot(getWindow().getDecorView());
In Fragment:
screenshot(getActivity().getWindow().getDecorView());
The only limitation I know is that it won't include the status bar.
if you use Mac, sometimes CMD + Shift + 4 (screenshot of a selected portion in OSX ) and then selecting the simulator region is enough :)
Take a screenshot
On many Android devices, you can capture a screenshot with a key-combination: Simultaneously press-and-hold Power and Volume-down. You can also capture a screenshot with Android Studio as follows:
Run your app on a connected device or emulator. If using a connected device, be sure you have enabled USB debugging.
In Android Studio, select View > Tool Windows > Logcat to open Logcat.
Select the device and a process from the drop-down at the top of the window.
Click Screen Capture on the left side of the window.
The screenshot appears in a Screenshot Editor window
It Works for even Genymotion Emulator
Check here for further information
Is there any terminal command that can be used to achieve this?
I know xcodebuild install -configuration can compile our xcodeproj from terminal without launching from Xcode, however the compilation files are under iOS but not in the iPhone simulator. I'm hoping one of you smart-folks can help me out.
Hey, i found out that you can do it with:
xcodebuild -configuration Release -sdk iphonesimulator2.2
This makes a simulator build with version 2.2 ( you can use xcodebuild -showsdks to list what u have avail ). I'm stuck with a problem of trying to get it to launch on the phone. xcodebuild -install doesn't seem to do anything for me :S
Any assistance?
Please see the following github project (search for iphonesim)
This will allow you to launch the iphone simulator from the command line.
(Sorry, it won't seem to let me post a valid URL in this answer)