Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor: ANDROID_HOME is not set even though it is set

OS : Ubuntu 14.04 Framework: Meteor 1.1.0.2 Application Name: Songofy

Here's the output of meteor install-sdk android

 meteor install-sdk android
✓ Found Android bundle
✓ A JDK is installed                          
✓ Found Android Platform tools                
✓ Found Android Build Tools                   
✓ Found Android 19 API                        
✓ Found suitable Android x86 image            
✓ 'meteor' android virtual device (AVD) found 
✗ Android emulator acceleration is not installed
  (The Android emulator will be very slow without acceleration)
Platform requirements not yet met             
Please follow the instructions here:          
https://github.com/meteor/meteor/wiki/Mobile-Dev-Install:-Android-on-Linux#haxm

I cd into the Directory using

cd Desktop/songofy

Then I type sudo add-platform android, and it asks me to accept the eprmission and then this happens:

`You must agree to the terms to proceed.       

Do you agree (Y/n)? Y

/home/abhishek/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:245
                        throw(ex);
                              ^
Error: Error running /home/abhishek/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/tools/cordova-scripts/cordova.sh

/home/abhishek/.meteor/android_bundle/.cordova/lib/npm_cache/cordova-android/3.6.4/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.

I add the ANDROID_HOME variable using this.

 abhishek@TiltedLines:~/Desktop/songofy$ export ANDROID_HOME=~/.meteor/android_bundle/android-sdk
 abhishek@TiltedLines:~/Desktop/songofy$ export PATH=$ANDROID_HOME/tools:$PATH
 abhishek@TiltedLines:~/Desktop/songofy$ export PATH=$ANDROID_HOME/platform-tools:$PATH

What is the problem with Cordova and Meteor?

like image 920
code Avatar asked Jun 17 '15 08:06

code


People also ask

How do you verify Android_home has been added?

properties, first make sure that the file is there in your project folder/android. If the file is there open it and make sure that the sdk. dir is pointing to your android SDK directory. Secondly, make sure that the ANDROID_HOME is there in the system variables and is also pointing to your android SDK directory.

What is Android_home variable?

Android SDK environment variables. ANDROID_HOME. Sets the path to the SDK installation directory. Once set, the value does not typically change, and can be shared by multiple users on the same machine. ANDROID_SDK_ROOT , which also points to the SDK installation directory, is deprecated.


1 Answers

I figured it out. It was a permission issue. Because the android is installed as a user and the environment variable were set for the user, sudo cannot access the variables.

So what I did is

sudo -E su

I am using this to transfer the environment variables for root user. I run meteor it installs meteor for root. do a meteor install-sdk android it installs the sdk for root as well, then run sudo add-platform android. Root has both meteor and the android sdk now, so the app runs.

Hope this helps. Wasted a lot of time on this.

like image 67
developernaren Avatar answered Oct 01 '22 02:10

developernaren