I followed a tutorial to use command to build, run, ... in phonegap at http://docs.phonegap.com but I can't use those commands, except the Create command.
The Create command is:
create ./test1 com.test1 test1
the original command is: $ /path/to/cordova-android/bin/create.bat /path/to/my_new_cordova_project com.example.cordova_project_name CordovaProjectName
After created project successfully, I run the command:
cd test1/cordova/build
the original command is: $ /path/to/my_new_cordova_project/cordova/build.bat
but it throws an error:
'build' is not recognized as an internal or external command,
operable program or batch file.
Then I go to my new project folder, go in folder: cordova to look for build.bat, but I see nothing.
Can you show me how to fix this stuff, i want to use command to build my phonegap project. Thanks!
Additional info:
Using phonegap 2.6, android platform.
Windows 7 64bit.
I'm able to run command: ant, java, javac, and some in the android platform tools,...
Related
What I am trying to do: I am trying to install ktlint on windows locally
What I tried:
Used below command in command prompt
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.38.1/ktlint && chmod a+x ktlint
Also tried above command by using in below steps in link
https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
What is happening: Not able to install in windows.
How to install in windows ?
I was having trouble installing ktlint for Windows 10. What worked for me was going to the Releases page, downloading the ktlint file, renaming the ktlint file to ktlint.jar and adding it inside my Android project root folder (in reference to this GitHub issue) (Note: Java must be installed so that the file extension can be recognized), then running java -jar ktlint.jar --apply-to-idea-project (in the command line, from the Android project root directory). Then finally I was able to get it to work, resulting in the following text:
The following files are going to be updated:
.\.idea\codeStyles\codeStyleConfig.xml
.\.idea\codeStyles\Project.xml
.\.idea\inspectionProfiles\profiles_settings.xml
.\.idea\inspectionProfiles\ktlint.xml
.\.idea\workspace.xml
Do you wish to proceed? [y/n]
(in future, use -y flag if you wish to skip confirmation)
y
(updated)
Please restart your IDE
(if you experience any issues please report them at https://github.com/shyiko/ktlint)
Without updating the file to have the .jar extension and adding .jar to the filename command line parameter, I kept getting the following error:
Error: Unable to access jarfile ktlint
To run ktlint immediately, run java -jar ktlint.jar in the command line (in the directory where the ktlint.jar file resides).
You can install a git hook to automatically check files for style violations on commit by entering the following command in the Command Line (run "ktlint installGitPrePushHook" if you wish to run ktlint on push instead):
java -jar ktlint.jar installGitPreCommitHook
But this will only allow you to set hook for your current command line session. If you close out of Command Prompt, the settings will be reset. If you want to have the ktlinter run on every session for your project, you have to add the java -jar ktlint.jar command to your project's .git/hook/pre-commit file and paste the ktlint.jar file into the .git/hook folder as well.
Download the ktlint jar ffile from the lib and add it in your project
Run java -jar ktlint on the command line
From that point and then gradlew ktlintCheck should work
Getting error - 'gradlew' is not recognized as an internal or external command. operable program or batch file. inside Android Studio terminal.
Can anyone please tell why it's not recognizing gradlew
gradlew command is available in your project directory. If you are trying to run this command from somewhere else it will throw error.
Also gradlew command package is automatically generated by Android studio when you create a new project. It will also prompt you to generate new gradle wrapper when you open the project.
you have to use ./gradlew instead of gradlew , if you are using Mac or Linux
It's under the Android folder, so you have to do cd Android first from your project root folder, then :
PS C:\code\my_app\android> ./gradlew signingReport
in vscode do this step
go to your project directory
cd to android
type ./gradlew in your terminal instead of gradlew
voila, it works for windows user
Assume that you app's name is video_compresser, so when you open terminal on Windows PC(because I am trying this on Windows) it shows the prompt like this.
C:\Users\Nuwan\StudioProjects\video_compresser>
If you run gradlew from here you will get the below message
'gradlew' is not recognized as an internal or external command,
operable program or batch file.
so you have to go to android directory by typing cd android command from terminal.
then the prompt should be like this,
C:\Users\Nuwan\StudioProjects\video_compresser\android>
then type gradlew followed by other commands you need and the error should be gone.
Try using,
./gradle clean
./gradle assembleRelease
worked for me.
make sure you have debug.keystore file in
PS C:\code\my_app\android>
before you run
./gradlew signingReport
Instead of the powershell, use the Windows Command Prompt to run the command.
(This is an accidental finding. I used the visual studio code terminal to run the command gradlew assembleRelease to build the apk of a react-native project, but it outputs an error similar to above. I tried bash terminal, again failed to run. Out of curiosity, I used the Windows command prompt, then it worked. Hope this will help if other solutions are not working).
If you use powershell, and the gradlew file is in the terminal current work directory, try .\gradlew instead of gradlew. Powershell don't run the command in the current work directory automatically.
ionic cordova build android --prod --release --alias=cos-android --password=abcd --versionCode=00001 --versionName=00001 -- -- -- --packageType=bundle
cordova build android --prod --release --alias=cos-android --password=abcd --versionCode=00001 --versionName=00001 -- -- --packageType=bundle
gradlew command is only available in your project directory or gradlew file location. If you are trying to run this command from somewhere else it will throw error.
so go to that particular location where gradlew file available
go to android directory by typing
"cd android" in terminal.
then the prompt should be like this,
PS C:\src\offx> cd android
PS C:\src\offx\android>
(//then type) ".\gradlew signinReport"
PS C:\src\offx\android> .\gradlew signinReport
Then you will get your sha keys
I am using windows OS and have to run a Java project in IntelliJ. I used the command prompt in admin mode then it worked for me.
When I try to build my app, using Linux ElementaryOS (Ubuntu 12.04 (I think?)) I get thousands of errors saying:
rm: could not remove file (code EACCESS)
The results of the following show:
$ phonegap -v
3.5.0-0.20.4
$ cordova -v
3.5.0-0.2.4
$ ant -v
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
Trying the default build file: build.xml
Buildfile: build.xml does not exist!
Build failed
Any suggestions? I've been battling through several errors for about a week now :(
Thanks in advance!
Update
Update I just changes the permissions of platforms/android too 777 (not a great solution I know). It's now giving me the following:
[Error: An error occurred while listing Android targets] { [Error: /var/www/ppl/app/platforms/android/cordova/build: Command failed with exit code 2] code: 2 } –
Okay, after much pain and anguish... I figured it out.
1). I installed ANT after I installed ionic/cordova/phonegap etc, the best order to install everything in is, java, ant, then cordova/phonegap/ionic.
2). I'm using 64-bit Ubuntu, if you are using the same then you need to install several android 32-bit libs.
3). I deleted the entire project (apart from my css, added js files and my html templates), created a new one using $ ionic start test-app then I ran $ ionic platform add android then ran $ ionic run android and it worked.
4). Make sure your paths are correct in ~/.bashrc mine look as followed:
export PATH=$PATH:/home/ewan/adt-bundle/tools
export PATH=$PATH:/home/ewan/adt-bundle/platform-tools
Here's a video that helped me, especially with the 32-bit libs. https://www.youtube.com/watch?v=zEQIwKK7YjY
Don't give up, it's worth it in the end. Best of luck!
I am currently attempting to build tess-two for an OCR android application via command line as instructed on https://github.com/rmtheis/tess-two. This is done on my macbook, OSX 10.9.4.
In order to build tess-two, this must be typed into command line:
$ 1git clone git://github.com/rmtheis/tess-two tess
$ cd tess
$ cd tess-two
$ ndk-build
$ android update project --path .
$ ant release
I encountered a problem as soon as I enter:
$ android update project --path .
This is the error displayed:
-bash: android: command not found
I have spend many hours trying to remedy this, and so far nothing fruitful has come of it. I appreciate any suggestions. Thanks.
This means the android command is not in your PATH. Try typing which android. It should give you the location if it is within your PATH.
Usually android can be found in your SDK directory under tools
You've got two options:
run the command with your_sdk_path/tools/android update project --paht
add android to your PATH with
export PATH=$PATH:/your_sdk_path/tools
You must have downloaded Android Development Toolkit bundle first. https://developer.android.com/sdk/index.html?hl=sk#mac-bundle
Then add /sdk/tools to your path.
I hope you know how to configure your path. If you are not sure please have a look at this : http://www.cyberciti.biz/faq/appleosx-bash-unix-change-set-path-environment-variable/
I have been trying to get my head around using uiautomator and I understand creating the test cases. I tried the first two steps of building the JAR according the the Android developer guide for UI Testing (http://developer.android.com/tools/testing/testing_ui.html) and that worked fine, but I am unsure on how to follow the next steps and building the JAR file with ant. Please can anyone help me with this issue.
Here are the steps that I have done so far:
<android-sdk>/tools/android create uitest-project -n <name> -t 1 -p <path>
set ANDROID_HOME=<path_to_your_sdk>
This is the step that I am stuck on:
ant build
The error I get when I use the command prompt is:
'ant' is not recognized as an internal or external command, operable program or batch file.
In the terminal run
which ant
It seems you do not have ant installed. If no location like /usr/bin/ant shows up after you run the command above, use this to install it:
sudo apt-get install ant
Try again after. It should work.
If you're using ADT, I recommend downloading Apache ant and placing it within the sdk/tools/ant folder. Then change your PATH variable to direct to the ant bin folder.
you have this error because you wrote "ant build" from incorrect path.
I did (this command generate build.xml, local.properties, project.properties files):
<android-sdk>/tools/android create uitest-project -n <name> -t 1 -p <path>
I changed in build.xml first line like:
<project name="name" default="build">
after that I run ant from eclipse. Build was success.
Have you installed ant? If not then do it from this site: http://ant.apache.org/manual/install.html
If yes then follow these steps:
Navigate to your project directory and means (go to bin of your project)
Using command window execute the function: ant build
Ensure that your default JAVA_HOME points to JDK installation, not the JRE, and check if your compiler is in the PATH. Try to type “javac” in the command prompt. If javac is not found, then you should put your bin directory in the PATH.
For example, in Windows:
SET PATH=c:/jdk1.5.0_07/bin;%PATH%
This site might help further: http://looksok.wordpress.com/2014/02/08/uiautomator-in-eclipse/
If you have ADT with Eclipse then you can find ant in the plugins directory of Eclipse.