I read these instructions:
BaseGameUtils import using Eclipse
It says you need to run "make_eclipse_compat" script.
Stupid question: How do I run the script on windows?
I tried the following:
start key
cmd.exe (run as administrator)
cd c:\android-basic-samples-master\scripts
run make_eclipse_compat
But that writes not output (no error message either) and does not create the eclipse_compat folder.
I cannot simply double click the script as it has no file ending.
From looking at the file in text editor I'd say it looks rather like a batch file. But appending .bat and running that does not work either.
What is the correct way to run the script?
I looked into the file and the first line says #!/bin/sh
According to the internet that means it is a bourne shell script which you run using bash.exe
So I installed cygwin, copied bash.exe to the android-basic-samples-master folder,
then in cmd.exe executed
bash Scripts/make_eclipse_compat
and the script finished successfully.
Get rid of the run. In Windows, if there is a .bat script, you simple execute:
make_eclipse_compat
or
make_eclipse_compat.bat
In the directory that has the script.
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
Bit of a noob question but I'm building an app in react native and to make development a bit faster I'm using a make file for arbitrary commands. I need to run an executable in a sub-directory but can't get this to work while using the Makefile command.
The command works when I cd into the directory then run it but this doesn't work when I use the exact same commands for the make command and I'm sure there's a one line answer to this somewhere but I haven't been able to find it.
Doing this works
user#device:~/project$ cd android
user#device:~/project/android$ ./gradlew assembleRelease
but having it in the makefile like so doesn't
///////// Start of Makefile /////
apk:
cd android/
./gradlew assembleRelease
///// End of file ///////
user#device:~/project$ make apk
Why not just use android/gradlew assembleRelease?
There is some good info elsewhere on SO about why commands like cd won't work as expected in a makefile.
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.
So I'm having the same issue as this guy in this question
android' is not recognized as an internal or external command
But when I changed my PATH variable and added the path to android.bat my cmd still does gives
'android' is not recognized as an internal or external command,
operable program or batch file.
My PATH looks like this
D:\Program Files\Java\jdk1.7.0_04\bin;D:\BossGrand\Programing\Ant\apache-ant-1.8.4\bin;C:\Program Files\TortoiseSVN\bin;D:\Program Files\Android\tools
and I made sure android.bat is inside D:\Program Files\Android\tools
I know this because when I go to this directory I can use the android update project command just fine
Does anyone know why I still can't use the android command?
Use the command prompt with admin .It work for me : )
You might have installed Cygwin as part of the SDK. I had the same problem "android.bat is not recognized as an internal or external command". So, Uninstall the Cygwin and try again (you might not able to uninstall Cygwin, since a mysterious “permission denied” when deleting the Cygwin files by default). You need to own access to this mysterious Cygwin files by doing
Take ownership: takeown /r /d y /f cygwin (do this, wherever is your cygwin folder is)
This command takes ownership recursive of the folder, without asking anything and gives Full Access to Everyone recursively in the folder:
icacls cygwin /t /grant Everyone:F And finally, the command which deletes it all and removes Cygwin:
rmdir /s /q cygwin Good bye Cygwin!
Now try again. (This worked for me)
PS: You can always re-install cygwin again. So, nothing wrong giving it a try. Good Luck
you must enter the command with complete arguments
android update project -p .
be carefull you must enter a dot at the end of command.
My project is an AndroidNDK project and requires some build commands to run from Cygwin (or a Unix environment). Is there a way to do this using TeamCity?
I tried using the commandline build step and passing in a batch file which first launches cygwin, and then performs the build commands I need. However this does not work, all it does is launch cygwin, but my unix commands do not get executed after this.
How are you launching and running commands from cygwin?
You will have to do bash -c "command you want to run" (assuming bash.exe is on path). Just calling bash and then giving commands will just launch bash.
I used cygwinonce. I tried doing similar you wanted to do.I wanted to start cygwin with default command.
bash --login -i myBashScript.exe
only when we paste myBashScript.exe in bin folder.