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

Abh*_*oni 6 javascript android apk cordova meteor

操作系统: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
Run Code Online (Sandbox Code Playgroud)

我用cd进入目录

cd Desktop/songofy
Run Code Online (Sandbox Code Playgroud)

然后我输入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.
Run Code Online (Sandbox Code Playgroud)

我使用它添加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
Run Code Online (Sandbox Code Playgroud)

Cordova和Meteor有什么问题?

dev*_*ren 4

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

所以我所做的是

sudo -E su
Run Code Online (Sandbox Code Playgroud)

我用它来传输 root 用户的环境变量。我运行meteor它为root安装meteor。执行以下操作,meteor install-sdk android它也会安装sdkroot 权限,然后运行sudo add-platform android​​. Root现在既有meteor又有android sdk,所以应用程序可以运行。

希望这可以帮助。在这上面浪费了很多时间。