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
Related
I am new in Hybrid app development.I have been assigned a task to develop Android & IOS app using Cordova apache.
As I work on Lamp environment, so I started installing the software for the same.
Software I have installed are
Cordova
npm
Android studio
apache ant
PhoneGap
But even after installing and following the all the instructions given on the internet.I am not able to prepare my build for the testing purpose.
Below is the error I am facing/getting when running the command sudo cordova requirements
Requirements check results for android: Java JDK: installed 1.8.0
Android SDK: not installed Failed to find 'ANDROID_HOME' environment
variable. Try setting setting it manually. Failed to find 'android'
command in your 'PATH'. Try update your 'PATH' to include path to
valid SDK directory. Android target: not installed Android SDK not
found. Make sure that it is installed. If it is not at the default
location, set the ANDROID_HOME environment variable. Gradle: not
installed Could not find gradle wrapper within Android SDK. Could not
find Android SDK directory. Might need to install Android SDK or set
up 'ANDROID_HOME' env variable. Error: Some of requirements check
failed
Note:I have already set the environment variable in .bashrc file ,but still facing the issue .
Please help!
in /home/user/.bashrc you must to set the ANDROID_HOME and PATH like this:
export ANDROID_HOME=/home/user/Android/Sdk/
and you PATH like this:
export PATH=/home/user/Android/Sdk/tools/:$PATH
There is a cordova project developed using Visual Studio - Tools for Apache Cordova (TACo).
While building the project for iOS target, we are able to get the build and debug successfully, on simulator as well on real iOS device.
But while building the same for Android target, it is working with Ripple browser emulators but it is not working with Android emulator or Android real devices.
I have tried updating environment variables manually as well through VS > Tools > Options > Tools for Apache Cordova > Environment Variables Overrides option, which includes
ADT_HOME /* This is basically android path */
ANT_HOME
GIT_HOME
JAVA_HOME
I have also verified ANDROID_PATH environment variable value in System Variables, and checked in command prompt using "echo %ANDROID_HOME%", it prints: C:\Program Files (x86)\Android\android-sdk;
VS > Tools > Options > Tools for Apache Cordova > Environment Variables Overrides
Require guidance where should the change is required.
Here is the Build error log:
MSBUILD : cordova-build error : Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable. (TaskId:10)
Done executing task "MdaVsCli" -- FAILED. (TaskId:10)
Done building target "BuildMDA" in project “MyProjectName.jsproj" -- FAILED.: (TargetId:11)
Project Performance Summary:
4704 ms C:\MyProjectDir\MyProjectName.jsproj 1 calls
4704 ms build 1 calls
The issue was related to Environment Variable only. I used to add semicolon at the end of all the file locations, but for JAVA_HOME, if we add semicolon it is not working with VS TACo.
Hence, i removed the semicolon from the end, and now the JAVA_HOME looks like this:
JAVA_HOME = C:\Program Files (x86)\Java\jdk1.8.0_60
App is now working with Android simulator as well.
The recent Android SDK tools removed the android command.
This issue is resolved recently in Cordova. Check out this link for more info on this
You can also downgrade your tools to a version where the android was still available.
Hope it helps
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.
Trying to use Phonegap in Eclipse on windows 8. I've created a project at C:\Development\HelloWorld. In the command line, when I type:
phonegap local build android
I get the following error:
An error occurred during creation of android sub-project. ERROR : executing command 'ant', make sure you have ant installed and added to your path.
My PATH:
C:\Program Files\nodejs\;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\adt-bundle\sdk\tools;%JAVA_HOME%\bin;%ANT_HOME%\bin;
Whats going wrong? I have downloaded Ant into my Development folder and all other necessary downloads are downloaded as well. Any help would be appreciated.
I was following Phonegap's platform guide for Android and I kept getting the above error. The directions on the guide were a little confusing. I went back to check what I had installed and found some configuration errors.
Under Environment Variables, I created new ANDROID_HOME, ANT_HOME, and JAVA_HOME system variables with the respective physical file paths as the value. This part may be overkill, but I was trying to cover my bases and I have noticed no significant issues with it so far.
Example:
Variable: ANDROID_HOME Value: C:\Development\adt-bundle\sdk
Variable: ANT_HOME Value: C:\Development\apache-ant-1.9.2
Variable: JAVA_HOME Value: C:\Program Files\Java\jdk1.6.0_45
Next I added the following values to the Path system variable in Environment Variables:
%JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
After making these changes and continuing to follow the guide, everything worked like it should. It boiled down to not having my system variables set to the correct physical file path.
Check android in cmd, if it says: 'xcopy' was not recognized.
then add to your path:
%SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;
Just as a extra note to Rex_C's answer: Be sure to reference the Java Development Kit (JDK) and not the Java Runtime Environment (JRE) in the JAVA_HOME variable. This will prevent the
Command failed to execute : ant jar
error when running phonegap->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.