Not able to build Android calabash environment on windows - java

For building the environment I've installed/use OS Windows 8.1, eclipse, Android SDK, JDK, ruby installer, DevKit installed. Also I've set path for ANDROID_HOME, JAVA_HOME. I've tried maximum ways to resign JAR but not getting that jar so I'm stuck at the point and unable to move forward. did google for my problem. Now I got confused what will be step by step execution to make my environment to run? Or shall I need to build this structure on Linux to make it easier run?

First open 'CMD' or 'CMD with Ruby'
Run the following command
cucumber --version
if cmd shows cucumber version, proceed to next step
calabash-android version
if cmd show calabash-android version, you're ready to run calabash-android testcase.
Then create a folder, cd to that folder and run these commands.
$ calabash-android gen #this will create folder structure
$ calabash-android resign apk_path/<apkfile.apk>
$ calabash-android build apk_path/<apkfile.apk>
$ calabash-android console apk_path/<apkfile.apk>
You will see interactive ruby editor, now type the following command
$ start_test_server_in_background # app will install in connected device.
Then
$ query("*")
Now you can see all the elements in your android application!!
If you face any error/issue in any steps, your setup may be incomplete.

Related

How to create a script to run the jar (while installing SBT)?

I am installing SBT on Mac. I am following the instructions mentioned (cryptically) on the website. I am now at the stage 'Installing sbt manually'. Under 'Unix', it reads:
Put sbt-launch.jar in ~/bin.
Create a script to run the jar, by creating ~/bin/sbt with these contents:
#!/bin/bash
SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar `dirname $0`/sbt-launch.jar "$#"
Make the script executable:
$ chmod u+x ~/bin/sbt
I have put sbt-launch.jar in the correct folder. But I do not understand what the rest means. How can you create the script: in the terminal? Is the code to make the script executable something that you have to execute once in the terminal?
(And after finishing the installation, how will you be able to open SBT?)
The easiest way for you to install sbt on macOS without much terminal interaction is homebrew. It's a popular package manager and it likely will be useful for you in the future. So just click the link and follow the instruction to install (it's just one command to paste to the terminal). The run
brew install sbt
That's it. Now to launch sbt you just run sbt command in a folder with your projects. Actually, these instructions are on the sbt web-site in the section 'Installing sbt on Mac'.
So if you are following 'Installing sbt manually' on purpose, the "Create a script" part means just to create a "text file" in any editor you use, paste those lines in it, and save to the proper location. Then run chmod command in the terminal. That's it.
About adding something to PATH check this article.

I am getting the following error when I run mvn on OS X Mavericks: Cannot run program "/bin/sh": error=2, No such file or directory

I am running OS X Mavericks on a MacBook Pro.
I have maven 3.0.5 installed.
When I run mvn, I am getting the following error message.
Error while executing process. Cannot run program "/bin/sh": error-2, No such file or directory
And before you ask:
PATH="/usr/local/apache-maven-3.0.5/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin:/usr/local/bin:/bin:/usr/bin"
M2_HOME="/usr/local/apache-maven-3.0.5"
M2="/usr/local/apache-maven-3.0.5/bin"
MAVEN_OPTS="-Xms256m -Xmx768m -XX:MaxPermSize=512m"
I am also seeing the following near the beginning of the mvn output:
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Failed to use environment variables for interpolation: Cannot run program "env": error=0, spawn failed #
I had the same problem: exec() failed with ANY executable. Finally remembered that I was using a private jre. That jre was a copy of the original one, just with bin/java set as executable.
I made lib/jspawnhelper executable and it worked!
If you are using eclipse , this is due to the java version. point java to your OS java instead of eclipse java. this will be solved
It seems your system is missing the "sh" shell to start interpreting the script.
I just looked up installed shells on Mac OSX and got this result:
/bin/zsh
/bin/ksh
/bin/tcsh
/bin/bash
/bin/sh
So when "/bin/sh" is missing, try "/bin/bash" for example.
Better:
Check if "/bin/sh" exist
If exist check if the user which runs the command can execute the shell
Because it can be possible that the shell binary exist but isn't executable for you. Then you have to make it executable for the user trying mvn.
Hope that helps ;)

Eclipse Error for GLPK library: The dynamic link library for GLPK for Java could not beloaded

I have a java program in which a use the GLPK Solver. The error that i receive when i run it on eclipse is the following:
The dynamic link library for GLPK for Java could not beloaded.
Consider using
java -Djava.library.path=
The current value of system property java.library.path is:
/Users/maria/Documents/solver_library/GLPK/w64
I had the same problem on my old windows computer and i solved it doing the following:
1. Adding in the Java Build Path->Libraries the glpk-java.jar file
2.Adding as the Native library location of the above jar the corresponding path (C:\ProgramFiles\solver_library\GLPK\w64
3. adding in the PATH environment variable the above path.
I am doing exactly the same things on my new MAC OS X computer but still receiving the above error. I did with exactly the same way the steps 1 and 2 above and also I modified through the terminal the PATH system variable. This now is:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/maria/Documents/solver_library/GLPK/w64
Could you please tell me if you have any idea of how to solve this? I am a new Mac user so i don't know many things.
Thanks in advance!
Here's what I did to make it work on OS X.
Install glpk.
I used for this homebrew
$ brew install glpk
$ brew install swig // this package we well need for glpk for java
Install glpk for java http://sourceforge.net/projects/glpk-java/files/glpk-java/
Unzip the archive with:
$tar -xzf glpk-java-1.0.37.tar.gz
$cd glpk-java-1.0.37
Configure with:
$./configure \
CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers \
SWIGFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
Make and install with:
$make
$make check
$make install
Now in swig dir you should have 3 jars:
glpk-java.jar, glpk-java-sources.jar, glpk-java-javadoc.jar and the .lib folder (hidden).
For compiling you need to put glpk-java.jar in your classpath and specify javac option -Djava.library.path=/YOUR_PATH/libglpk-java-1.0.37/swig/.libs

Cannot run program "bash": Launching failed?

I have imported an example from FMODProgrammersApi example and I have done the procedure of Cygwin and Android NDK but when i run my project it gives following error in console
14:53:34 **** Incremental Build of configuration Default for project Recording ****
bash /ndk-build all
Cannot run program "bash": Launching failed
Error: Program "bash" not found in PATH
PATH=[C:/Program Files/Java/jdk1.6.0_06/bin/../jre/bin/client;C:/Program Files/Java/jdk1.6.0_06/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_06/bin/../jre/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\system32\Wbem;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files\Java\jdk1.6.0_06\bin;D:\ABHIJEET_ONYX\New_Android_Sdk\adt-bundle-windows-x86-20140321\eclipse;]
14:53:35 Build Finished (took 267ms)
Please help me ...
I have gone through this tutorial http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/
There is no bash command in Windows platforms by default.
You can install a git which has one bash command and set the git bin folder (such as C:\Program Files (x86)\Git\bin) into system/user's path environment

deploying java through Cygwin

My Java development done in a windows machine and i run my processes on a centos machine.
I have a bash script that build all my Jars and SCP them to my centos machine. i run this bash script in Cygwin (java -version is 1.5.0_12), but when i try to run the process in my centos machine, the jVM can't open the Jars. also, running jar -tf throws:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.zip.ZipFile.<init>(ZipFile.java:75)
at sun.tools.jar.Main.list(Main.java:979)
at sun.tools.jar.Main.run(Main.java:224)
at sun.tools.jar.Main.main(Main.java:1149)
so the only way i can deploy is running mvn commands in cmd.exe in order to build my jars and then copy everything using WinSCP (that way i have no problems in the jars).
is there any known problem running mvn in cygwin?
(running mvn -version returned
Apache Maven 2.2.1 (r801777; 2009-08-06 22:16:01+0300)
Java version: 1.6.0_26)
thank you
Solved it.
i found the solution in cygwin sets file permission to 000
Edit /etc/fstab and add this line at the end of the file:
none /cygdrive cygdrive binary,noacl,posix=0,user 0 0
Then close all Cygwin processes, open a new terminal and ls -l on your files again.
Maven being a Java application runs the same whether launched via Cygwin script or cmd.exe. The Java executable in this case is the same tool.
First, you might want to post the copy command you are using in the bash script. Secondly, have you checked the permissions on the jar files once they are pushed to the CentOS box? Are the files actually readable to the process owner when sent via your bash script and are the owners/permissions the same as when copied using WinSCP?

Categories