gpt4 book ai didi

android - $ANDROID_HOME 的 Meteor 添加平台错误

转载 作者:太空宇宙 更新时间:2023-11-04 12:55:47 24 4
gpt4 key购买 nike

我正在尝试将 android 添加到我在 ubuntu 上的 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,但仍然遇到相同的错误。这些是 the instructions我在关注——他们过时了吗?

编辑:在尝试解决此问题的最后努力中,我尝试使用 these instructions 安装 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.)

不知道如何解决这个问题;任何线索表示赞赏。

最佳答案

我能够通过首先删除 Cordova 缓存来解决这个问题:

$ sudo rm -r ~/.cordova/lib/npm_cache

然后我通过运行 /opt/android-sdk/tools/android 打开 SDK 管理器,重新安装了 Android sdk 和工具。

关于android - $ANDROID_HOME 的 Meteor 添加平台错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35778998/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com