maven dependency installation failure - android

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.

Related

Android environment in VS2015

try to build my first Android project in VS2015 and get the following error:
2> D:\Work\Train2015\ARM\Debug\Package\build.xml:45: sdk.dir is missing. Make sure ANDROID_HOME environment variable is correctly set.
ANDROID_HOME was set in my Windows environment:
set ANDROID_HOME=D:\Android\sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
Ideas?
I hope this info will save your time:
In VS2015 open your solution
In Solution Explorer select your Packaging project and open its Properties
Select Ant
In Additional Parameters add the following:
-Dsdk.dir=path_to_Root_Android_SDK
For example, -Dsdk.dir=D:\Android\sdk
Make it for Release and Debug configuration.

Set Android environment variables to work with Maven

I want to know how to set up correctly environment variables on a Mac. My OS is Mountain Lion and I'm getting the following output when trying to run "mvn clean install":
org.apache.maven.plugin.MojoExecutionException: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using <sdk><path>...</path></sdk> or <properties><android.sdk.path>...</android.sdk.path></properties> or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME

An error occurred during creation of android sub-project because a path is not found

I'm trying to do phonegap build android and I have this message :
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
[error] An error occured during creation of android sub-project. Path not found
Phonegap is looking for "C:\Documents and Settings\corbg\.cordova\lib\android\cordova\3.0.0\bin\create". There is nothing under the directory "3.0.0". I installed cordova like this npm install -g cordova.
I have the some problem when I run cordova platform add android.
Did I missing something?
In Windows machine you have to delete .cordova directory under
C:\Users\user_name\
I have face the same issue, then i corrected my application path, afterthat it is worked out for me.
If you are using win 7 then add the Android ADK path in
open the mycomputer -> Properties -> Change Settings-> Advanced -> Environment Variable -> User variable for ....-> path
add the Android ADK path here like as following
C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\tools; C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\platform-tools
also add JAVA_HOME and ANT_HOME.
- Abdul Jabbar
Did you set your PATH variable? Sometimes this error occurs in Windows when the PATH variable is not set correctly to access "java" and "ant" exes. If you want to test if they are correctly set, you can simply execute both (from any folder in your command line):
> java
or
> ant
and both programs should be found.
It was a problem with my proxy. Cordova create a .cordova directory and try to download something on the internet. The download did not work. Next time, it check if there is a .cordova directory. It don't try to redownload something because the directory exist and it show the error.
I removed the .cordova directory and I solved my problems with proxy. Now, everythings works.
What solved the issue for me was having 2 directories on my PATH, the android platform-tools and tools.
In my pc those folders were at
C:\Program Files (x86)\Android\android-sdk\tools
C:\Program Files (x86)\Android\android-sdk\platform-tools
Also make sure you have the following environment variables
JAVA_HOME (C:\Program Files\Java\jdk1.7.0_51)
ANT_HOME (C:\Program Files\apache\apache-ant-1.9.3)
ANDROID_HOME (C:\Program Files (x86)\Android\android-sdk\platform-tools)
I removed the .cordova folder under my user folder but I'm not quite sure if that helped as well.
These links may help you
An error occured during creation of android sub-project
android' is not recognized as an internal or external command
I had the exact same problem for a different reason. I had an old version of ant (1.7.1). At least version 1.8.2 is needed for the build to work.
its either due to improper installation or no installation of ANT or JAVA. But moreover we need to add Android SDk and prepare Android Targets via SDK manager before going through this.
This is because you haven't installed ANT!
download it from here and install it step by step
https://ant.apache.org/manual/install.html
Then running the last command it will install the dependencies needed.

Android Maven Project on Jenkins

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

cordova.cmd build android exited with exit code 1

I'm trying to run my application on an android emulator. I made all the coniguration necessary but it always returns me this error. Thank you for your help.
Error info :
cordova.cmd build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\comit\AppData\Local\Android\Sdk\ (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova
environment variable :
ANDROID_HOME C:\Users\comit\AppData\Local\Android\Sdk\
ANDROID_SDK_HOME C:\Users\comit\AppData\Local\Android\Sdk\
JAVA_HOME C:\Program Files\Java\jdk1.8.0_231\
Path :
C:\Users\comit\AppData\Local\Android\Sdk\tools\
C:\Users\comit\AppData\Local\Android\Sdk\platform-tools\ C:\Program
Files\Java\jdk1.8.0_231\bin\
Emulator :
Nexus_5X_API_25
Try installing Gradle in your system
as you are using a Windows system follow the following steps
Step 1:-
Download the latest version of Gradle from here.
Step 2:-
Unpack the Gradle distribution ZIP into C:\Gradle using an archiver tool of your choice.
Step 3:-
Under System Variables select Path, then click Edit. Add an entry for C:\Gradle\gradle-6.0.1\bin.
Create a new environment variable called GRADLE_HOME and add C:\Gradle\gradle-6.0.1 value to it.
To verify Gradle installation execute gradle -v. It should return the gradle version.

Categories

Resources