Meteor:ANDROID_HOME即使已设置也未设置

时间:2015-06-17 08:25:33

标签: javascript android cordova meteor apk

操作系统:Ubuntu 14.04 框架:Meteor 1.1.0.2 申请名称:Songofy

以下是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

我使用

进入目录
cd Desktop/songofy

然后我输入sudo add-platform android,它要求我接受eprmission然后发生这种情况:

`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.

我使用它添加ANDROID_HOME变量。

 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

Cordova和Meteor有什么问题?

2 个答案:

答案 0 :(得分:4)

我明白了。这是一个许可问题。因为android是作为用户安装的,并且为用户设置了环境变量,所以sudo无法访问变量。

所以我做的是

sudo -E su

我使用它来为root用户传输环境变量。我运行meteor它为root安装meteor。执行meteor install-sdk android它也会为root安装sdk,然后运行sudo add-platform android。 Root现在有meteor和android sdk,所以app运行。

希望这会有所帮助。浪费了很多时间。

答案 1 :(得分:1)

我在下面的环境中遇到了同样的问题:

  • Meteor 1.5
  • Android SDK工具26
  • $ANDROID_HOME设置正确

以下是我修复的方法: