我试图在ubuntu上添加android到我的meteor项目,并且收到与$ ANDROID_HOME变量相关的错误。
$ meteor --verbose add-platform android 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 ✗ 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我不太明白这个错误,因为它似乎认识到有一个SDK,但后来找不到它。
这是我添加到〜/ .bashrc文件底部的内容:
export PATH=${PATH}:/home/sarah/Android/Sdk/tools/ export PATH=${PATH}:/home/sarah/Android/Sdk/platform-tools/ export ANDROID_HOME=/home/sarah/Android/Sdk/ export PATH=$PATH:$ANDROID_HOME/tools/:$ANDROID_HOME/platform-tools/我一直试图解决这个问题几天,所以自从添加之后,我不仅运行了source ~/.bashrc而且还注销了并重新启动了我的计算机。
如果有任何帮助,这就是我的$ANDROID_HOME样子:
$ ls -l $ANDROID_HOME total 40 drwxrwxr-x 2 sarah sarah 4096 Mar 1 20:45 add-ons drwxrwxr-x 4 sarah sarah 4096 Feb 23 11:24 build-tools drwxrwxr-x 4 sarah sarah 4096 Feb 22 2015 extras drwxrwxr-x 3 sarah sarah 4096 Mar 1 20:45 platforms drwxrwxr-x 5 sarah sarah 4096 Feb 11 11:54 platform-tools -rw-rw-r-- 1 sarah sarah 1158 Mar 21 2014 SDK Readme.txt drwxrwxr-x 3 sarah sarah 4096 Mar 1 20:45 sources drwxrwxr-x 3 sarah sarah 4096 Feb 22 2015 system-images drwxrwxr-x 2 sarah sarah 4096 Mar 1 20:43 temp drwxrwxr-x 12 sarah sarah 4096 Feb 11 12:50 tools我已经看过很多关于类似问题的其他线程,但还没有找到解决方案。 例如,许多人错误地使用sudo但我认为这不是我的问题。
但是,根据评论者的请求,他已经删除了他们的评论,我尝试用sudo运行它。 这并没有解决问题。
编辑:我尝试重新安装Android Studio和SDK版本22,我仍然得到相同的错误。 这些是我所遵循的指示 -他们是不是在一天之外?
编辑:在尝试解决此问题的最后努力中,我尝试使用这些说明安装Android和Cordova。 现在我得到一个奇特的新错误,大概是我的Cordova安装:
$ meteor add-platform --verbose android Adding platform Android to Cordova project => Errors executing Cordova commands: While adding platform Android to Cordova project: Cordova error: CordovaError: Failed to fetch platform android Probably this is either a connection problem, or platform spec is incorrect. Check your connection and platform name/version/URL. undefined at /home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/cordova/platform.js:270:25 at _rejected (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:797:24) at /home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:823:30 at Promise.when (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:1035:31) at Promise.promise.promiseDispatch (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:741:41) at /home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:557:44 at flush (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:108:17) at process._tickCallback (node.js:448:13) (If the error message contains suggestions for a fix, note that this may not apply to the Meteor integration. You can try running again with the --verbose option to help diagnose the issue.)不知道如何解决这个问题; 任何线索都赞赏。
I am trying to add android to my meteor project on ubuntu and am getting an error related to the $ANDROID_HOME variable.
$ meteor --verbose add-platform android 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 ✗ 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. ✓ GradleI don't quite understand this error since it seems to be recognizing that there is an SDK but then can't find it.
This is what I have added to the bottom of my ~/.bashrc file:
export PATH=${PATH}:/home/sarah/Android/Sdk/tools/ export PATH=${PATH}:/home/sarah/Android/Sdk/platform-tools/ export ANDROID_HOME=/home/sarah/Android/Sdk/ export PATH=$PATH:$ANDROID_HOME/tools/:$ANDROID_HOME/platform-tools/I've been trying to fix this for a few days, so since adding that, I have not only run source ~/.bashrc but have also logged out and back in and have restarted my computer.
Here's what my $ANDROID_HOME looks like if that's any help:
$ ls -l $ANDROID_HOME total 40 drwxrwxr-x 2 sarah sarah 4096 Mar 1 20:45 add-ons drwxrwxr-x 4 sarah sarah 4096 Feb 23 11:24 build-tools drwxrwxr-x 4 sarah sarah 4096 Feb 22 2015 extras drwxrwxr-x 3 sarah sarah 4096 Mar 1 20:45 platforms drwxrwxr-x 5 sarah sarah 4096 Feb 11 11:54 platform-tools -rw-rw-r-- 1 sarah sarah 1158 Mar 21 2014 SDK Readme.txt drwxrwxr-x 3 sarah sarah 4096 Mar 1 20:45 sources drwxrwxr-x 3 sarah sarah 4096 Feb 22 2015 system-images drwxrwxr-x 2 sarah sarah 4096 Mar 1 20:43 temp drwxrwxr-x 12 sarah sarah 4096 Feb 11 12:50 toolsI have looked at many other threads about similar problems and haven't found a solution. For example, many folks mistakenly use sudo but I don't think that's my problem.
However, per the request of a commenter who has since deleted their comments I have tried running it with sudo. That did not solve the issue.
EDIT: I tried reinstalling Android Studio and the SDK version 22 and am still getting the same errors. These are the instructions I am following-- are they out of day?
EDIT: In a last-ditch effort to try and fix this, I tried to install Android and Cordova using these instructions. Now I get a fancy new error having to do, presumably, with my Cordova install:
$ meteor add-platform --verbose android Adding platform Android to Cordova project => Errors executing Cordova commands: While adding platform Android to Cordova project: Cordova error: CordovaError: Failed to fetch platform android Probably this is either a connection problem, or platform spec is incorrect. Check your connection and platform name/version/URL. undefined at /home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/cordova/platform.js:270:25 at _rejected (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:797:24) at /home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:823:30 at Promise.when (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:1035:31) at Promise.promise.promiseDispatch (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:741:41) at /home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:557:44 at flush (/home/sarah/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/q/q.js:108:17) at process._tickCallback (node.js:448:13) (If the error message contains suggestions for a fix, note that this may not apply to the Meteor integration. You can try running again with the --verbose option to help diagnose the issue.)No idea how to fix this; any clues appreciated.
最满意答案
我能够通过首先删除Cordova缓存来解决这个问题:
$ sudo rm -r ~/.cordova/lib/npm_cache然后我通过运行/opt/android-sdk/tools/android来重新安装Android sdk和工具来打开SDK管理器。
I was able to fix this by first deleting the Cordova cache:
$ sudo rm -r ~/.cordova/lib/npm_cacheAnd then I reinstalled the Android sdk and tools by running /opt/android-sdk/tools/android to open the SDK manager.
更多推荐
发布评论