Java error when running ionic build android - javascript

After installing ionic and android sdk one windows, I tried to build a sample app running the command ionic build android.
It so happens that after running this command, and after some seconds the following message appears:
Usage: java [-options] class [args...]
(to execute a class) or java [-options] -jar jarfile [args...]
(to execute a jar file) where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image See http://www.oracle.com/technetwork/java/javase/documentation/index.html
for more details.
Error: cmd: Command failed with exit code 1
For this error I tried to reinstall java JDK7 and also installed JAVA8, and also I switched node version (tried node 8 and 6) , but nothing has worked. Because this error is so generic, I am having difficulties knowing what should I look for.
I'm also running windows 7.
Can anyone help me with this?

Related

Azure Functions: How to debug in WebStorm?

The azure-functions-cli offers a way to kickoff debugging, but these instructions seem to be Visual Studio specific.
I tried using a similar trick to serverless by setting up a run config in WebStorm to point the JavaScript file to:
\node_modules\azure-functions-cli\lib\main.js
And then passing the Application args:
run myFunctionName --debug
This successfully runs the functions with Azure's tools, but both WebStorm tries to set a debugging port; and when the Azure window opens up it sets its own debugging port.
From Webstorm:
C:\Program Files (x86)\JetBrains\WebStorm 2016.2.3\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" --debug-brk=60168 --expose_debug_as=v8debug C:\Users\username\AppData\Roaming\npm\node_modules\azure-functions-cli\lib\main.js run myfunction --debug
Debugger listening on [::]:60168
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException:
Likewise, Azure-cli says it opens a debugging port, but they do not match.
As a result, breakpoints set are ignored when the functions are called (Though it does successfully run).
Anybody know how to configure this properly to be able to use WebStorm to debug?
Azure-Functions-CLI was renamed to azure-functions-core-tools. If you still have the Azure-Functions-CLI see my legacy response at the end of this post.
If you're running the new azure-functions-core-tools it looks like they broke the capability to run a remote debugger :-(.
I have the following issue opened and I will update if they tell me otherwise:
https://github.com/Azure/azure-functions-core-tools/issues/378
Fortunately, the new Beta version of the azure-functions-core tools doesn't have all of this C# craziness that prevents it from running on other OSes and requires a remote debugger. To install that version, you can use:
npm i -g azure-functions-core-tools#core
With that version installed, you can launch things with the good 'ol standard Node runtime.
Within WebStorm from Run -> Edit Configurations create a new "Node.JS".
Give the debugging some type of name.
Set the JavaScript file to:
~\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js
NOTE: The above assume you installed Azure Functions on a Windows machine with the global flag.
Set the Application Parameters to: start --debug VSCODE
Edit the file ".vscode\launch.json" and change the debug port to 9229 for node.
Within WebStorm choose Run-> Debug:"What_You_Named_the_Remote_Profile"
Add some breakpoints.
Navigate to your API end-point and see that the break-points work.
NOTE: By default it appears the function will be at http://localhost:7071/api/functionName
------------------- EDITED But Below Held for Posterity --------------
Okay, it looks like you can not do this with local debugging, but can with "Remote Debugging" within WebStorm.
Within WebStorm from Run -> Edit Configurations create a new "Node.JS Remote Debug".
Give the debugging some type of name.
Hit the + Sign where it says, "Before Launch: External Tool" and choose "Run External Tool".
Hit the + Sign again and fill it out like the screen-shot (This is assuming you installed the Azure Function CLI globally).
NOTE: The above screenshot has been updated based on the latest version of Azure Functions CLI/. Earlier versions required you to state an app name, and did not require --debug to debug. As a result if you are not updated to the latest version of Azure Functions CLI (now known as Azure-Functions-Core-Tools) you may need to have "run MyApp" in the Parameters field.
Within WebStorm choose Run-> Debug:"What_You_Named_the_Remote_Profile"
Add some breakpoints.
Navigate to your API end-point and see that the break-points work.
NOTE: By default it appears the function will be at http://localhost:7071/api/functionName
Add this to your local.setting.json file under values: "languageWorkers:node:arguments": "--inspect=5858"
Click Edit configuration. Click the plus icon and choose Attachto Node.js/Chrome
Fill in these values for the options: host: localhost - Port: 5858 and set Attac to option to "Crhome or Nod.js>6.3 started with --inpect"
Start the function and run the debugger
See this picture: https://i.stack.imgur.com/hnC74.png

Android_Studio Error

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: C:\Users\User_Name.gradle\caches\2.14.1\classAnalysis\cache.properties (System cannot find the file)
Android-Studio show this error message and I don't know what it is or what should I do.
It show this when I try to run an app and I answer "Proceed without Instant Run" to this question:
"Instant Run requires that the platform corresponding to your target device (Android 1.0) is installed."
At first Upgrade SDK Manager .
This exception is thrown during a failed attempt to open the file denoted by a specified pathname.
You can use
compile 'com.google.android.gms:play-services:current_version'
& Use this
classpath 'com.android.tools.build:gradle:current_version'
Then Clean-Rebuild Your Project .
Delete folder config in C:/user/user/.android
As my opinion , this type of error found When your app run in Instant Run feature of Android Studio. so, new build not generated every time and app content not found in your android device.
Click here to get solution
http://tools.android.com/tech-docs/instant-run

setup cloud code for Parse.com

I have gone through the instruction found on Parse.com to setup Cloud code. I downloaded exe file as instructed in 1. It seems like there is a step missing before step 2.
When i run "parse new" in the command prompt i get "not recognized as an internal or external command". What am i missing? How do i install/use cloud code?
Get the Parse tool
The Parse command line tool for Windows is available here. Download
the Windows executable named: parse.exe at this link. Note that this
is not an installer, it is just a plain Windows executable.
Set up a Cloud Code directory.
From the Command Prompt, run the command parse new and follow
instructions. In this quickstart we'll see how to set up your server
code on Heroku. Please read docs for more details.
I just downloaded the parse CLI on my Windows desktop to figure it out and I believe I've found your solution.
You need to open up a standard command line on windows and then navigate to where you have stored parse.exe. Once the command line is at the same directory as the exe, you will be able to run parse new and any of the other CLI commands.
For example, you could do the following:
Hit the Windows key (or start menu) and search "cmd" then hit enter to open the command line
Navigate to where parse.exe is located. If it's on your desktop, it could be something along the lines of cd C:\Users\<name>\Desktop
parse help, parse new and so on should now work from this directory
The documentation feels a bit vague and could use some clarification for the Windows platform. Hope this helps!

How to debug node.js application with Visual Studio 2013 and Node Tools NTVS

I have moved an existing node.js + express project to VS because I prefer the IDE over JetBrains for now (used VS for years, only peeked into Webstorm).
I used NTVS new project->from existing sources and all files were imported successfully.
Afterwards, I opened the project settings of my project and set the node.exe arguments to bin\www, startup file for express.
When I press F5 (debug) I get the console.log messages I have put into the www and app.js files in the opening command prompt, and it looks like the server is running (cannot confirm, I want to debug if everything is working), but the VS debugger directly exits again, it also does not open any page in the browser I selected for debugging.
My node app actually is a REST webservice, so I want to test different URLs with different parameters.
Also, I cannot access the app on the port I specified, though when I directly start it from node.exe I can, even though the command prompt is still open.
(I have NTVS and WebEssentials installed - some operations take a long long time, but I attribute this to NTVS being still an early version.)
Question: how does the Visual Studio debugger stay connected to the node.js application so I can use breakpoints and use any browser then to connect and test different URLs? (Even a breakpoint put on the console.log that gets printed during startup is not being triggered.)
For everyone who asks receives, and the one who searches finds....
(and yes, I did spend a long time searching and trying before posting here..)
Kind of nice to debug node.js server with VS..
hope this helps someone
Edit: The arguments to node.exe can be hard to read in the image. It must be
--debug=<portno>
that is with two dashes (and not just one) to specify the debug port.
Not so much knowledge on expressjs but with a recent release of NTVS 1.0 Alpha, I did find it supports remote debugging which can be also used to debug nodejs app running locally - anyway haven't tried if it works with nodejs app + expressjs but it should.
I followed the step in this video https://youtu.be/-ir9ZB8lUg4 which is
Run your nodejs with node.exe RemoteDebug.js <your_javascript_file>.
RemoteDebug.js has come when you install NTVS.
In Visual Studio, select Debug > Attach to Process
Select Node.js remote debugging for Transport
Enter localhost:5859 for Qualifier
Click Attach
This will put Visual Studio in debugging mode which you can set a breakpoint, do step-in/step-out, very same experience when you use VS to debug .NET app.
Its pretty straight forward with NTVS, you can download required version for your windows from github here
Once you install NTVS, NodeJS project templates will be added
Now, Goto File->New project -> Basic NodeJS Express 3 application (it will be available in javascript project templates)
Now just goto debug and select Start Debugging, add breakpoints where ever required and you can start debugging

Phonegap build cordova.js

I am developing Phonegap Build application. For the android file,when I try to compile the zip file, the APK file always contain 3 javascript file:phonegap.js cordova.js ... Yet the three files are of exactly the same content. How can I remove the two redundant js file in order to optimize my application?
FYI the reason the redundant files are present is to avoid user confusion according to the devs:
Many users were including the wrong file. Allowing inclusion of any of
the above avoided a lot of confusion -- enough to outweigh the
footprint of two extra files, in our opinion.
Now that PhoneGap 2.8 introduced cordova.js without the version number in the filename, there is a low-priority issue being tracked to remove the redundant files (so if you just wait, it might be fixed soon on its own):
Enhancement: PhoneGap 2.8 introduce cordova.js without version number.
Build could now exclude redundant .js files.
But, if you aren't willing to wait for them to upgrade the build process, you can remove the files yourself following these instructions:
1. Unpack the APK files into a local directory structure using apktool (you'll need the Android and Java SDKs installed on your machine) - instructions here on how to unpack and remove files:
$ \path\to\AndroidSDK\platform-tools\apktool d myApp.apk
2. Remove the phonegap.js and cordova-x.x.x.js files (these are the unused ones in > 2.8.0).
3. Repackage the APK, again using apktool:
$ \path\to\AndroidSDK\platform-tools\apktool b myApp myAppUnsigned.apk
note at this point that the APK isn't signed, and therefore can't be deployed to the Play Store or any devices which doesn't allow apps from unsigned sources.
4. Re-sign the APK file using your android cert so it's valid:
Sign the apk using the jarsigner tool that’s part of the Java JDK.
You’ll also need your keystore and key alias that you used to sign the
app, as well as the password.
jarsigner -verbose -keystore ~/MySigningKey.keystore ~/Desktop/myAppUnsigned.apk myKeyAlias
Enter Passphrase for keystore:
After you enter your passphrase, you’ll see a whole bunch of ‘signing:’ messages zoom by; once it’s all done, you have a signed apk file.
5. The last step is to zipalign the apk file:
zipalign -v 4 myAppUnsigned.apk myApp.apk
And you should be done. You could automate all these steps into a batch/shell script for ease of use when building files.

Categories

Resources