I have tried using Jenkins with my Android project which I'm using Maven for. I have tried following this tutorial except the emulator part since I don't have any tests (yet). http://vitorbaptista.com/continuous-integration-for-android-apps-with-jenkins-and-maven3/
I am getting the following error when I try building my project in Jenkins:
message : Failed to execute goal
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources
(default-generate-sources) on project ....: Execution
default-generate-sources of goal
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources
failed: Could not find tool 'aapt'. Please provide a proper Android
SDK directory path as configuration parameter
... in the plugin . As an
alternative, you may add the parameter to commandline:
-Dandroid.sdk.path=... or set environment variable ANDROID_HOME. cause : Execution default-generate-sources of goal
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources
failed: Could not find tool 'aapt'. Please provide a proper Android
SDK directory path as configuration parameter
... in the plugin . As an
alternative, you may add the parameter to commandline:
-Dandroid.sdk.path=... or set environment variable ANDROID_HOME.
Here is my configuration for Android and Maven:
Jenkins
(that folder is the right one, I've checked a million times)
Project
I have tried even chmod 777'ing the path to my SDK directory in the case Jenkins doesn't have access.
Any ideas?
Unfortunately, it was as simple as installing the platform tools. Since I have always worked with the SDK via UI, I haven't thought about the installation of the platform tools. After installing the platform tools, everything built.
The command was as simple as:
[sdkdir]/tools/android update sdk --no-ui --filter platform-tool
Related
i am new in Ionic. I added android platform in my ionic application and tried to run the application in real android device but i am getting following error in my command prompt i am using windows 10 machine on my end.
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: C:\Users\CURRENT_USER\AppData\Local\Android\sdk\tools\templates\gradle\wrapper
following are my environment variables:
ANDROID_HOME=C:\Users\CURRENT_USER\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\java\jdk1.8.0_121
Please suggest
I think you need to update android sdk,
First you update your android sdk atleast API LEVEL 19 & tools & extra options
as follow
& make sure to add sdk url in environment variable
New Android Studio has moved gradle wrapper to C:\Program Files\Android\Android Studio\plugins\android\lib\templates\gradle\wrapper. I copied the templates\ folder to sdk\, then passed the compilation. However the command "Ionic emulate android" still failed with "Error: cmd: Command failed with exit code 1". I don't know how to go further :(
I run ionic run android and it starts to download lots of things except gradle that i downloaded it and set the path myself, now i have 2 question:
1: Should ionic framework always download lots of things with every new project?
and
2: How i resolve the below error , i set ANDROID_PATH variable to point Android-SDK where packages exist
What went wrong:
A problem occurred evaluating root project 'android':
No installed build tools found. Install the Android build tools version 19.1.0
or higher.
The answer is yes (through Gradle) and you have to set ANDROID_HOME and then add to PATH based on this.
On the Mac I had much the same problem. I was lacking the Android SDK. I don't know if that was your problem. I'll assume you don't have the SDK but you can pick up from your problem place in this list.
Download and install Android SDK for you platform. I'm on Mac so will present instructions from that perspective.
Go to Configuration on login splash screen or Preferences through File or Apple menu.
Go to Appearance and Behaviour > System Settings > Android SDK
Observe the Android SDK Location. Mine is /Users/me/Library/Android/sdk
Open ~/.profile
Add export ANDROID_HOME=/Users/me/Library/Android/sdk
Add export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Save and source ~/.profile
You could have the additional problem of not having Gradle installed. Try:
Download the binary
Extract to /usr/local or wherever you can write (eg. ~/lib where I install such things locally) if you don't have admin rights
sym link the version of gradle - cd /usr/local;ln -s gradle-3.5 gradle
Add /usr/local/gradle to your $PATH like above and source ~/.profile again.
I reread the question and realised I had added too much detail in my answer. I believe the $ANDROID_HOME and path line is what you are missing.
You may also need to open Android Studio and do whatever configuration it requires. And setup a SDK Platform also in that configuration window discussed above.
I hope that helps.
I am consistently running into the same error when I run "react-native run-android." Here is the error:
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find Build Tools revision 23.0.1
I tried this --> failed to find Build Tools revision 21.1.1 - sdk up to date --> and got the same error.
I installed the android sdk with homebrew and my ANDROID_HOME export is in my .bash_profile and .zshrc file as:
export ANDROID_HOME=/usr/local/opt/android-sdk
When I go to this directory and look in the "build-tools" directory I do see 23.0.1.
Does anyone have any advice?
EDITS:
I'm also unable to run "react-native run-android" with any flags. I'm not seeing any output from stacktrace, info or debug.
Finally figured it out! Chris Geirman's answer is also valuable, so I would start there as I did. One thing to mention is that I installed React Native with Homebrew. If Chris's method does not work look into the following:
Go to your React Native project directory that is created by react-native init
Open the android directory.
Open the file local.propertiesIf you don't have this file you can make one.
Make sure the sdk.dir value is pointing to the correct directory. In my case the path need to be sdk.dir = /usr/local/opt/android-sdk
As an extra bit of reassurance I also located that directory above to make sure that the build tools version that was missing (23.0.1) was in that directory.
EDIT:
I found that this is a post install error. If you run react-native init and you don't have $ANDROID_HOME set, you will run into this error.
I found this in the book Learning React Native and thought you might find this quote helpful.
If you receive a warning about a missing package, run android and check to see if
that package is listed as “installed”. If not, install it. If it is installed, but React Native
can’t find it, follow the steps above to try and fix any issues with your development
environment. You should also check to make sure that your ANDROID_HOME environ‐
ment variable is properly set and points to your installation of the Android SDK. For
example, on my system:
$ echo $ANDROID_HOME
/usr/local/opt/android-sdk
I am trying to automate the android build process using Jenkins
I am using the following site to achieve this
Link to site
I am successfully able to Build it on my own machine. Initially i got error saying that build.xml file not found (build using ant requires this file). So i execute "android update project". So it automatically generate all necessary file for ant.
Now my problem begins when i tried to host my repo to remote server and tried to build from another machine. The error it is giving is the sdk.dir is not correct. When i analysed the project folder ther is a file called local.properties which contains the SDK path of my first machine which is wrong for other machines. So i add that file to gitignore. Now that file is not tracking and because of this the build is failing.
So is there any way to automatically generate the files that is necessary for ant after jenkins is cloning project from the remote repo?
From the website you link to, they precisely explain how to configure sdk.dir:
Configuring the environment
When jenkins builds your project with Ant, it needs to know where your
android sdk folder is. To do this, click Advanced on the Ant target
build step you just configured and add the following variable to the
Properties field. sdk.dir=/opt/android-sdk-linux/
Don’t forget to substitute the value of the variable with the correct
location where the Android SDK is installed on your build server.
Job configuration is done. Click Save. Time to test your build.
We also build android apps with Jenkins, and also need to edit the local.properties.
In my case, I have the file updated with the path to SDK by the Jenkins build itself. Just before the build starts.
You can use a simple sed command on linux or echo the content on windows (overwriting content).
Example flow:
SCM - get sources
Edit the local.properties (as suggested before)
Run ant build
Note - if you are using the "Invoke Ant", you should add an "Execute Shell" step before to deal with the editing of the local.properties.
I hope this helps.
Yes.
If you install the Android Emulator Plugin for Jenkins, you can add the "Create Android build files" build step to your job.
This will automatically detect any Android app, test or library projects in your Jenkins workspace and add/update the build.xml and local.properties files as necessary.
Alternatively, if you're using the Ant build step and already have the build.xml in your repository, you can ignore the need to create a local.properties file, by specifying the sdk.dir property yourself in the Advanced Ant options.
You can configure ant properties in jenkins. So you can specify all properties of your local.properties through the jenkins job configuration.
Of course you will have to install the android sdk on the jenkins build server.
Please read this for info on how setting ant properties with jenkins.
It's not a good practice to put the local.properties under source code management since multiple developers and CI will have different values for those properties.
you can edit the local.properties file in the jenkins workspace folder to the correct sdk path
I think you want to add the build step "Create Android build files" to your configuration. Place it before the ant build.
This invokes the android update project and android update lib-project. Make sure you referenced your library dependencies in the project.properties with relative paths. Like this:
# Project target.
target=Google Inc.:Google APIs:19
android.library.reference.1=../external-libs/google-play-services_lib
android.library.reference.2=../external-libs/android-support-v7-appcompat
I am building an Android project with Eclipse and maven plugins. When I build it I get the error as following
27/1/12 2:34:02 PM IST: Build errors for ProjectName;
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal
com.jayway.maven.plugins.android.generation2:maven-android-plugin:2.2.1:generate-sources
(default-generate-sources) on project ProjectName: Execution
default-generate-sources of goal
com.jayway.maven.plugins.android.generation2:maven-android-plugin:2.2.1:generate-sources
failed: Please provide a proper Android SDK directory path as
configuration parameter <sdk><path>...</path></sdk> in the plugin
<configuration/>.
As an alternative, you may add the parameter to commandline:
-Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME
Even if I have set the ANDROID_HOME and path in <sdk><path>...</path></sdk>
Besides ANDROID_HOME environment variable, you also need add $ANDROID_HOME/tools and $ANDROID_HOME/platform-tools to your PATH environment variable:
Maven 3.0.3+ installed, see http://maven.apache.org/download.html
Set environment variable ANDROID_HOME to the path of your installed Android SDK and add $ANDROID_HOME/tools as well as $ANDROID_HOME/platform-tools to your $PATH. (or on Windows %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools).
MacOS users: Note that for the path to work on the commandline and in IDE's started by launchd you have to set it in /etc/launchd.conf and NOT in .bashrc or something else
Check out the Getting Started page on android maven plugin website here.
Hope this help.
You also need to set the path location of the Android SDK in Eclispe as well, otherwise the m2e-android build will fail:
Go to Window -> Preferences and select Android. Click on the Browse... button next to the SDK Location text box and select the location of you locally installed Android SDK. Click Apply and then OK and your build should now work.