Android SDK installed but not found - android

I'm installing an environment for an Ionic project on Windows 10. I downloaded Android studio and installed SDK in
C:\Users\user\AppData\Local\Android\sdk
My system variable ANDROID_HOME=C:\Users\user\AppData\Local\Android\sdk
Executed OK:
ionic platform add android
But :
$ ionic run android
Running command: "C:\Program Files\nodejs\node.exe" C:\Users\KGE\SVN\trunk\sagaMobile\hooks\after_prepare\010_add_platform_class.js C:/Users/KGE/SVN/trunk/sagaMobile
add to body class: platform-android
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.
I tried to find a solution for 2 days but nothing works. If you have any ideas ...
EDIT:
I use Git bash for input. I have the same with CMD, even as admin.
EDIT 2:
Solved by removing and reinstall of the whole project

Related

sudo ionic run android not working

I am trying to run a hybrid app on my android phone using ionic using the following command:
sudo ionic run android
However I keep receiving this error :
Error: 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.
I have already added platform tools & tools to PATH updated ANDROID_HOME to point to my sdk root.
The ANDROID_HOME environment variable shows up when I run env and the PATH has the tools and platform tools too. Additionally I can execute android too. It launches the SDK Manager as expected.
Details:
ANDROID_HOME: /home/user/Android/Sdk
$PATH: /home/user/Android/Sdk/tools:/home/user/Android/Sdk/platform-tools
Please help! This is driving me up the wall!
Credit for this goes to #heemayl on AskUbuntu.
https://askubuntu.com/a/783805/247116
sudo sanitizes the environment and by default only keeps certain
environment variables available with modifying the values of some
(e.g. PATH).
You can pass the variable ANDROID_HOME manually:
sudo ANDROID_HOME="/actual/path" ionic run android
Or preserve the current environment:
sudo -E ionic run android

Meteor 1.2 Failed to find ANDROID_HOME

Problem: Meteor cannot find my Android SDK when I try to meteor add-platform android on Linux Mint.
I've set my PATH variable: (echo $PATH)
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/jimmy/Android/Sdk/tools:/home/jimmy/Android/Sdk/platform-tools
I've got my ANDROID_HOME variable: (echo $ANDROID_HOME)
/home/jimmy/Android/Sdk
But still, when I run sudo meteor add-platform android --verbose I get:
Adding platform Android to Cordova project
% Adding android project...
android: added platform
Checking Cordova requirements for platform Android
Your system does not yet seem to fulfill all requirements to build apps for
Android.
Please follow the installation instructions here:
https://github.com/meteor/meteor/wiki/Mobile-Development-Install:-Android-on-Linux
Status of the requirements:
✓ Java JDK
✗ Android SDK: 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: 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: 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.
Okay, so I figured it out? (I guess)
So, I had already had my PATH and ANDROID_HOME set and everything, I could do echo $PATH and echo $ANDROID_HOME and it would print fine; but when I would run the different commands, it wouldn't work.
however, when I run sudo -s and then the commands, it works fine.
Cheers
ANDROID_HOME must be set to Android/Sdk folder. In my case (Ubuntu) it is:
export ANDROID_HOME="/home/***<user name>***/Android/Sdk"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Put this lines at the end of ~/.profile:
$ gedit ~/.profile
Then $ source ~/.profile
I had the same issue (and now I am stuck to Android target), but to solve Android SDK,
go to Android studio and ensure you remove everything from Android 6,
then that you have Android 5.1.1 installed (with v22 of the platform),
restart your console (I had to restart the laptop)
and normally it doesnt appear again (btw you dont need to use sudo normally)
It's possible that since you're using SUDO - that the PATH / ANDROID_HOME are not present in the root user's session. So try either:
sudo -s
export PATH=...
export ANDROID_HOME=...
meteor ...
or avoid using sudo.

Can't execute ionic application in genymotion

I try to execute an application implemented using Ionic within the Genymotion Android emulator.
To create my application, I did the following:
$ ionic start myApp blank
$ ionic platform android
$ ionic run android
Notice that I executed the last command after having started a virtual terminal (Sony Xperia Z for example).
I have the following error:
Running command: /(...)/myApp/hooks/after_prepare/010_add_platform_class.js /(...)/myApp
add to body class: platform-android
Running command: /(...)/myApp/platforms/android/cordova/build
[Error: 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.]
ERROR building one of the platforms: Error: /(...)/myApp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /(...)/myApp/platforms/android/cordova/build: Command failed with exit code 2
I don't understand why I need to have an ANDROID_HOME set since it's not the thing I want to use...
I installed then an Android SDK and set the ANDROID_HOME environment variable:
export ANDROID_HOME=/home/(...)/android-sdk-linux/
Then I have the following error:
$ ionic run android
Running command: /(...)/myApp/hooks/after_prepare/010_add_platform_class.js /(...)/myApp
add to body class: platform-android
Running command: /(...)/myApp/platforms/android/cordova/run
ERROR: Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running: /home/(...)/android-sdk-linux/tools/android
You will require:
1. "SDK Platform" for android-22
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)
ERROR running one or more of the platforms: Error: /(...)/myApp/platforms/android/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
What isn't clear to me is how to tell Cordova to use Genymotion instead of the default Android emulator...
For information, I installed ionic and cordava like this:
$ sudo npm install ionic -g
$ sudo npm install cordova -g
I'm working on Linux Mint 17 Qiana / Cinnamon 64-bit.
Thanks very much in advance for your help!
Thierry
From the logs it doesn't look like a problem with the emulator/Genymotion but a problem with not having the Android SDK installed. Because of the licenses involved you typically need to install the Android SDK yourself.
This explains the error messages:
It first looks for where the SDK is installed, which is indicated by ANDROID_HOME. It errors since it's initially unset.
Once it's set, it can't find the right SDKs (android-22, platform-tools, tools) since they're not installed.

An error occured During creation of phonegap android sub project

I am trying to build a phonegap android,At that time i got a message that
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
[error] An error occured during craetion of android sub-projesct. creating cordova project for the android platform
Please help me.
Thanks in advance.
Seems ant binary missing in your path!
In you install ant with npm like:
sudo npm install -g ant
Then just make symlink to bin folder what found in your $PATH like
sudo ln -s /usr/local/lib/node_modules/ant/ant/bin/ant /usr/local/bin/ant
There may be one of following two reasons-
1) .cordova directory already exists on your machine in your user folder. Delete it and try your command.
2)You have xcopy.exe somewhere on your machine. You should be able to add %SystemRoot%\System32 to your PATH.
or You can find it by running 'where xcopy' in your terminal window. XCOPY on the path is a requirement for setting up and installing Android
You need to define XCOPY on your path as it is used by the internal node.js scripts to move things around.
One of these should solve your problem.
I had same problem with cordova 3.3.1 and phonegap 3.3.0. Finally, I opened Android SDK manager and found out Platform tools were outdated, though I had the latest version from here. After update, this error was gone
Run the "android" command from your adt\sdk\tools folder and install the latest Tools and SDK. Also make sure your PATH has the right variables.
For this you will need ANT to be installed , a JAVA JDK and an Android SDK installed
JAVA_HOME (C:\Program Files\Java\jdk)
ANT_HOME ({ant location}\apache\apache-ant)
ANDROID_HOME ({android sdk location}\android-sdk)
Add these to your PATH variable like %ANT_HOME%/bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%JAVA_HOME%\bin
Close and re-open your cmd and run your command again.
Similiar to PhoneGap/Cordova Android Development

Installing Phonegap on Windows 7 : The command 'android' failed

I followed the documentation and some tutorials on Phonegap to install it on Windows 7, but I'm stuck.
So far, I've installed Java 1.7.0_06, Ant-Apache 1.9.2, Eclipse, Android SDK with Android 4.3 (API 18), all Tools and all Extras in the SDK Manager), NodeJS 0.10.18 and Git.
I wrote all paths in the PATH variables in Windows it's look like this (decomposed) :
F:\nodejs;
F:\android-sdk\sdk\platform-tools;
F:\android-sdk\sdk\tools;
%JAVA_HOME%\bin;
%ANT_HOME%\bin;
C:\Program Files (x86)\Git\bin
Where %JAVA_HOME% and %ANT_HOME% have the right path, they give me the their version when I type java -version or ant -version in the CLI
So I went in the CLI, I installed Phonegap with the following command :
npm install -g phonegap
It give me the 3.0.0-0.14.3 version when I type phonegap -v.
Now, I went to my folder F:\apps and I created a new project with the following command :
phonegap create hello com.example.hello HelloWorld
Everything goes well, the files are created.
I went in the 'hello' folder, and I typed this command :
phonegap local build android
And there come the problem, I get this error :
[phonegap] adding the Android platform...
[error] The command `android` failed. Make sure you have the latest AndroidSDK installed, and the `android` command (inside the tools/ folder) added to your path. Output:
I tried this command too :
phonegap build android
But it get stuck at this, nothing happen next :
[phonegap] detecting Android SDK environment...
[phonegap] using the remote environment
[phonegap] compressing the app...
After lot's of research, I don't know what I can do anymore to find the problem, and I'm quiet new with all this CLI... So yeah, do you have any idea why the command 'android' failed ?
Thanks
Open environment variables, on the first part 'user variables' add new variable with this name android and the variable F:\android-sdk\sdk\tools;
Then edit the user variables PATH and add this at end of the line %android%;
close your CMD and try again.

Categories

Resources