I'm trying to setup a jenkin to build the maven android project on ubantu machine
Android SDK : android-sdk_r23.0.2-linux.tgz
OS : ubantu
Maven home: /usr/share/maven3
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Installed the android dependency using the android SDK deployer
If i run the "mvn clean install" on command line project build successfully, but if i tried with a jenkin job it's failing because it's not able to find the manually installed jars.
jenkin user anonymous
Tried the following still facing the same issue:
I ran into a problem,
I added a new user by following this link https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-ubuntu-12-04-and-centos-6
Steps to add a new user as root:
sudo adduser jenkinadmin
sudo /usr/sbin/visudo
Edit the file as below
Adding the user’s name and the same permissions as root under the the user privilege specification will grant them the sudo privileges.
--#User privilege specification
root ALL=(ALL:ALL) ALL
jenkinadmin ALL=(ALL:ALL) ALL
Press ‘cntrl x’ to exit the file and then ‘Y’ to save it
and update the /etc/default/jenkins file JENKINS_USER to new user created above. then issue the
chown -R jenkinadmin /var/log/jenkins
chown -R jenkinadmin /var/lib/jenkins
chown -R jenkinadmin /var/run/jenkins
chown -R jenkinadmin /var/cache/jenkins
Then restarted the Jenkins jenkins and check the user has changed using a ps command
/etc/init.d/jenkins restart
ps -ef | grep jenkins
I can see the jenkin is staring with the same new user, but still im getting the same mave repo error.
also after editing the sudouser with the below command
sudo /usr/sbin/visudo
now I'm alsways prompt with this error
"jenkinadmin is not in the sudoers file. This incident will be reported"
Also I've installed the maven using the sudo apt-get install maven and this install the maven on
root#myBox:/etc# mvn -v
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T12:37:52-05:00)
Maven home: /usr/share/maven3
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-32-generic", arch: "amd64", family: "unix"
Since maven is running fine on the command line but has issues when running through Jenkins, it most probably means that it's a PATH issue. Just run Jenkins with the same user with which you're running mvn on command line.
To find out the user with which Jenkins is running, you can run this command:
[tom#jenkins_master ~]$ ps -ef | grep -i jenkins
ec2-user 20040 1 0 Sep15 ? 00:07:59 /etc/alternatives/java -Djava.awt.headless=true -Dhudson.util.ProcessTree.disable=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=8009 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20
tom 23248 23222 0 22:46 pts/0 00:00:00 grep -i jenkins
[tom#jenkins_master ~]$
As you can see from the above output, Jenkins is running as user ec2-user. If you've installed Jenkins without doing any customization, then the startup script will most probably be /etc/init.d/jenkins. If you will open this file, it should have the following entry:
JENKINS_CONFIG=/etc/sysconfig/jenkins
The above file (/etc/sysconfig/jenkins) contains the user name entry with which Jenkins will be running. You should change that but you will also have to make sure that you change the ownership of other files and directories that Jenkins uses. These can be seen from the output i pasted above:
/var/lib/jenkins/
/usr/lib/jenkins/
/var/log/jenkins/
/var/cache/jenkins/
These should do. After you make changes to the ownership and restart Jenkins, make sure to check the logs to ensure there are no permission issues. That's it.
To find the user with which you're running command on the command line, just type the following command:
[tom#jenkins ~]$ id
uid=514(tom) gid=515(tom) groups=515(tom)
uid=514(tom) portion of the above output confirms that you are currently logged in as user 'tom'.
Related
I have a run.sh like this
virtualenv -p python3 env
source env/bin/activate
pip3 install -r requirements.txt
python3 -m profilo.workflow_demo trace.log blocks
When i run this on terminal it runs ok but when i run this shell in external tools android studio it raise an error.
/home/cpu10475-local/Desktop/python/run.sh: 2: /home/cpu10475-local/Desktop/python/run.sh: source: not found
/home/cpu10475-local/Desktop/python/run.sh: 3: /home/cpu10475-local/Desktop/python/run.sh: pip3: not found
Process finished with exit code 1
My tool config is here:
I think the External Tools in Android Studio doesn't support source. So you should try removing the first 2 lines and installing pip3 then run the module again.
I am running a calabash-android test using docker. When I build the container with my docker file it seems like nothing executing except the first line. When I check whether ruby installed or not it shows the ruby version. Apart from that nothing is working. I am adding the docker file structure here.
############################################################
# Docker file to run Calabash for android automation testing.
############################################################
FROM ruby:2.1-onbuild
# install Android SDK dependencies
RUN apt-get install openjdk-7-jdk
# Install android sdk
RUN wget http://dl.google.com/android/android-sdk_r23-linux.tgz
RUN tar -xvzf android-sdk_r23-linux.tgz
RUN mv android-sdk-linux /usr/local/android-sdk
RUN rm android-sdk_r23-linux.tgz
# Install Android tools
RUN echo y | /usr/local/android-sdk/tools/android update sdk --filter platform,tool,platform-tool,extra,addon-google_apis-google-19,addon-google_apis_x86-google-19,build-tools-19.1.0 --no-ui -a
#install calabash-android
RUN gem install calabash-android
ENV ANDROID_HOME /usr/local/android-sdk
ENV ANDROID_SDK_HOME $ANDROID_HOME
ENV PATH $PATH:$ANDROID_SDK_HOME/tools
ENV PATH $PATH:$ANDROID_SDK_HOME/platform-tools
ENV JAVA_HOME /usr/lib/jvm/java-7-oracle
I have followed this link to implement the Docker file. Since this is for the first time I am setting up docker for android haven't the faintest idea whether it is proper or not. Someone please help to fix the issue. All kinda helps are appreciated.
I get this response for the docker build
Step 0 : FROM ruby:2.1-onbuild
# Executing 4 build triggers
Trigger 0, COPY Gemfile /usr/src/app/
Step 0 : COPY Gemfile /usr/src/app/ Gemfile: no such file or directory
First, as long as the docker build does not execute all the steps, it is perfectly expected to not see anything installed.
Second, the ONBUILD directives from the ruby:2.1-onbuild are made to complete the image when building a new one from said image.
As I mention before, you can try first using
FROM ruby:2.3.0
That does not require extra onbuild trigger.
I'm triying to build my first cordova project, when I'm inside the project folder i tip:
sudo cordova build android
and I get the following error:
[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]
ERROR building one of the platforms: Error: /home/veritopsecret/hello/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
when I do echo $PATH I get:
veritopsecret#veritopsecret-SATELLITE-PRO-C50-A-1HQ:~/hello$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/veritopsecret/Escriptori/android-sdk-linux/tools:/home/veritopsecret/Escriptori/android-sdk-linux/platform-tools
I have also modified .profile file, but it stills say that it hasn't android command in the PATH. However, if I just write android, it opens the android sdk manager. Help please!!
As I re-read your question, I see you run sudo cordova build android
I think the issue you have is that you define ANDROID_HOME and add the android tools to the path of your user but then you use sudo to run the build.
sudo runs with elevated privileges using a user which is not your user profile that you are logged with, so the path and ANDROID_HOME are not set. (maybe try sudo echo $PATH to be sure of that).
So if you really wanted to use sudo to build, you would need either to define the vars for the sudo user or use instead sudo -E (see this page for more details : https://wiki.archlinux.org/index.php/Sudo#Environment_variables)
But actually, you should be using sudo only when installing cordova, not when using the CLI.
So, just run cordova build android and everything should be fine.
i have installed android bundle and i have configured everything in .bashrc file and even when i say android in command line .. i am getting android manager .. but when i say ionic platform add android i am always getting error as "Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions." . i tried many way but issue not fixed .
my platform :
Ubuntu 14.04 64 bit
.bashrc file :
export HOME="/home/system"
export ANDROID_HOME="$HOME/adt-bundle-linux-x86_64-20140702/sdk/tools"
export ANDROID_PLATFORM_TOOLS="$HOME/adt-bundle-linux-x86_64-20140702/sdk/platform-tools"
export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH"
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
export ANT_HOME="/usr/share/ant"
export PATH="$ANT_HOME/bin:$PATH"
export ANDROID_HOME="/home/system/adt-bundle-linux-x86_64-20140702/sdk/tools"
error while execution :
system#system-H81M-S1:/usr/share/nginx/www/myApp# ionic platform add android
npm http GET https://registry.npmjs.org/cordova-android/3.6.3
npm http 200 https://registry.npmjs.org/cordova-android/3.6.3
npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.3.tgz
npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.3.tgz
Creating android project...
/system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:126
throw e;
^
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
at /system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/lib/check_reqs.js:158:19
at _fulfilled (/system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:760:13)
at /system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:821:14
at flush (/system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
Error: /system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/
create: Command failed with exit code 8 at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/
cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
may i know how i can fix this error
I faced the same problem, and it's solved.
I think it's issue with the compatibility of the latest cordova with latest android.
As well as you've issue with the android home path.
In .bashrc file
export HOME="/home/indranil"
export ANDROID_HOME="$HOME/software/adt-bundle-linux-x86_64-20140702/sdk"
export PATH="$HOME/software/adt-bundle-linux-x86_64-20140702/sdk/tools:$ANDROID_HOME/platform_tools:$PATH"
Try to download the latest android SDK if you're using older version.
And download Android 4.4.2(API 19) from your android manager.
You can use the latest cordova (4.0.0) but if the issue is still there then use cordova (3.5.0-0.2.7), but if you want to upgrade or downgrade the cordova, remove the existing one using:-
npm uninstall -g cordova (If linux use sudo npm uninstall -g cordova)
If you are using linux don't use
sudo
commad at the time of installing cordoava, if you get any error, run the following commands
sudo chown -R `whoami` ~/.npm
sudo chown -R `whoami` /usr/local/lib/node_modules
sudo chown -R `whoami` /usr/local
Then install cordova without sudo
npm install -g cordova#3.5.0-0.2.7
At the time of creating ionic app and adding android as platform don't use sudo command.
Cordova creates a .cordova directory in the home folder at the time of adding platform. Remove that directory before creating the new ionic application.
And after downloading the android(4.4.2), create an android virtual device using the command:
android avd
I have been struggling with this also (Ubuntu 14.04) and I remember accepting that just getting the cordova build command to work was too difficult for me :-). I was sure my PATHs were correct (tried root and user etc etc) and tried every solution I could find.
A comment by Stoicuta Alexandru On this page solved it for me. I quote:
If ANDROID_HOME is not set, cordova will search for it in home/android-sdk
So just putting my android sdk in the home-folder and (important) naming it android-sdk did it.
Hope to save some people some time...
I had the same problem but I found an alternative method i.e. using the Phonegap Developer App. You could install it to the emulator and use it.
In my case I first created the ionic app and ran other ionic commands using SUDO; that's why it was not working as sudo uses root profile.
This is how i fixed:
delete the /home/user1/.cordova (replace user1 with you user name)
i used "sudo rm" command to delete folder and all of its conents
i deleted the /home/user1/tmp folder so that when we run the cordova again it creates the new tmp folder with proper permission of current user
created new app using "ionic start app5" - this was the main issue as i previously was doing it with sudo
added platform using "ionic platform add android"
executed using "ionic run android"
remember that if from command line you can run "android" command and "java -version" command then above is perfect solution. let me know if you guys need any help from me.
After facing for many day with this issue i follow the instructions above and set my .bash_profile like this on MAC
#====================================================
export ANT_HOME=/usr/local/Cellar/ant/1.9.4/bin/ant
#
export HOME="/Users/User"
export ANDROID_HOME="$HOME/Downloads/Developer/adt-bundle-mac-x86_64-20140702/sdk"
export PATH="$HOME/Downloads/Developer/adt-bundle-mac-x86_64-20140702/sdk/tools:$ANDROID_HOME/platform_tools:$PATH"
#
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${PATH}
#
export PATH=${PATH}:/Users/User/Downloads/Developer/adt-bundle-mac-x86_64-20140702/sdk/platform-tools:/Users/User/Downloads/Developer/adt-bundle-mac-x86_64-20140702/sdk/tools:/Users/User/Downloads/Developer/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W
#
NPM_PACKAGES="${HOME}/.npm-packages"
PATH="$NPM_PACKAGES/bin:$PATH"
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
#
# Unset manpath so we can inherit from /etc/manpath via the manpath
# command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
If you know about Compatibility Test Suit for Android. Please send us the information regarding source code downloading of CTS, environment setup, building and execution.
You can find all the info about setting up and running CTS here.
If you are in a hurry,here are the commands you use most often:
Running CTS:
First, add the android-sdk-linux/platform-tools to the PATH using export PATH=$PATH:/your-path-goes-here
1- Navigate to the platform-tools directory and use
./android-cts/tools/startcts to start the CTS shell
2- run cts --plan CTS to initiate CTS
3- (OPTIONAL) ls --plan CTS to list all the individual test packages
4a- In case you want to run the entire test suite/plan:
start --plan CTS
4b- In case you want to run the test for a single package:
start --plan CTS -p package-name-goes-here
Download source code of CTS:
It's now available. You can just repo sync it, or git clone git://android.git.kernel.org/platform/cts.git
Env Setup and build
I also feel problems at building the cts. I build successfully once but other times I can't build it. You can see question here, I also record the step of my building.
Execution
Since I didn't got the cts tool, I can only recommend you read this, this is a 0xlad people's article.
To download the CTS compilable code you follow the instructions out here
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.3_r1
If you work for some of the OEM's Google will provide special cts branches, if not, you'll have to do with the above branch.
To build and run CTS :
cd /path/to/android/root
./cts/development/ide/eclipse/genclasspath.sh > .classpath
chmod u+w .classpath
cd /path/to/android/root
make cts
cts
This answer obviously applies to 4.0.3 version of Android. Things may or may not change from Jelly Bean onwards.
Download cts source code :
$ mkdir <dir_name>
$ cd <dir_name>
$ repo init -u https://android.googlesource.com/platform/manifest -b <tag_name> ( tag_name :- android-cts-8.0_r2, android-cts-7.1_r10)
$ repo sync -d -c –q
Compile complete cts package:
$ cd <dir_name>
$ . build/envsetup.sh
$ make cts -j TARGET_PRODUCT=aosp_arm64
Compile particular cts :
$ cd <dir_name>
$ . build/envsetup.sh
$ cd <testcase_dir_name>
$ mm
CTS setup includes 3 steps
Step 1 : CTS Dowloads
Step 2 : Desktop Machine Setup
Step 3 : Android Device Configuration
Step1 : Compatibility Test Suite Downloads
i)Download and open the CTS packages matching your device’s Android version and all the Application Binary Interfaces (ABIs) your devices support from following link
https://source.android.com/compatibility/cts/downloads.html
Then Unzip it and paste the android-cts to your workspace directory
ii)Download and open the latest version of the CTS Media Files.Unzip it and paste into your workspace directory
Step 2 : Desktop Machine Setup:
CTS currently supports 64-bit Linux and Mac OS host machines. CTS will not work on Windows OS.
i)Before running the CTS, make sure you have recent versions of both Android Debug Bridge (adb) and Android Asset Packaging Tool (AAPT) installed and those tools' location added to the system path of your machine.Ensure adb and aapt are in your system path
ii)set the path using the following command
$ export PATH=$PATH:/home/ramakrishna/Android/Sdk/build-tools/27.0.3
where 27.0.3 is
iii)Install the proper version of the Java Development Kit (JDK). For Android 7.0—
On Ubuntu, use OpenJDK 8.
On Mac OS, use jdk 8u45 or newer.
For details, see the JDK requirements.
please follow below link for complete details of Android Device configuration and Running CTS
Android CTS : downloading of CTS, environment setup, building and execution