Эмулятор Android Nativescript не работает

Прошло 4 дня с тех пор, как я пытался настроить свою среду Android, но все еще получаю кучу ошибок. Я сдался до того момента, когда переустановил свою Mac OS, но все еще не нашел решения

Я установил nativescript, как рекомендовано в документации, но когда я запускаю tns doctor, я получаю следующую ошибку:

✔ Getting environment information 

TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.

There seem to be issues with your configuration.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 4.1.2 version and is up to date.
✔ Component tns-core-modules has 4.1.0 version and is up to date.
✖ Component tns-android is not installed.
✖ Component tns-ios is not installed.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods update is not required.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✖ The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android. 
 To be able to perform Android build-related operations, set the `ANDROID_HOME` variable to point to the root of your Android SDK installation directory. 

✖ WARNING: adb from the Android SDK is not installed or is not configured properly.  
 For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements 

✖ WARNING: The Android SDK is not installed or is not configured properly. 
 You will not be able to run your apps in the native emulator. To be able to run apps
in the native Android emulator, verify that you have installed the latest Android SDK 
and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements 

✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later. 
 Run `$ sdkmanager` to manage your Android SDK versions. 

✖ You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=27'. 
 Run `$ sdkmanager` from your command-line to install required `Android Build Tools`. In case you already have them installed, make sure `ANDROID_HOME` environment variable is set correctly. 

✖ You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system. 
 Run `$ sdkmanager` to manage the Android Support Repository. In case you already have it installed, make sure `ANDROID_HOME` environment variable is set correctly. 

✖ WARNING: CocoaPods is not installed or is not configured properly. 
 You will not be able to build your projects for iOS if they contain plugin with CocoaPod file.
To be able to build such projects, verify that you have installed CocoaPods. 

You have nativescript-cloud extension installed, so you can execute cloud builds, but your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options: 
Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Skip Step and Configure Manually" to disregard this option and install any required components manually.
You have nativescript-cloud extension installed, so you can execute cloud builds, but your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options: 
Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Skip Step and Configure Manually" to disregard this option and install any required components manually.
? To continue, choose one of the following options:  (Use arrow keys)
❯ Try Cloud Operation 
  Configure for Local Builds 
  Skip Step and Configure Manually 

Я проверял каждую ошибку и каждый URL в каждой ошибке, не понимая этого.

Я проверил, что $ANDROID_HOME находится в моем ~ / .bash_profile, а также $JAVA_HOME.

У моего ~ / .bash_profile есть два пути:

export ANDROID_HOME=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/Home

Когда я запускаю tns doctor и выбираю «Настроить для локальных сборок», он начинает повторно загружать «Google Chrome», «Homebrew», «Java SE» и т. д., И даже тогда я все равно получаю ту же ошибку.

Я попытался указать эмулятор, даже когда получил тот же результат, что и команда tns doctor.

2
0
1 746
1

Ответы 1

Если вы не хотите устанавливать Android Studio, вы можете попробовать следовать эта пошаговая настройка.

По моему опыту, для macOS лучшим решением является установить Android Studio.

После этого вы можете использовать Android Studio для управления версиями SDK и эмуляторами Android (что лучше для отладки, профилирования и просмотра журналов во время разработки) и принятия лицензий.

Переменные среды (которые будут добавлены в ваш профиль bash), указывающие на установленный Android Studio SDK и инструменты сборки:

export ANDROID_HOME=/Users/{{ username }}/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME

Затем перезагрузите компьютер (иначе вы, вероятно, не сможете запускать эмуляторы из Android Studio). После перезапуска откройте терминал и введите

echo $ANDROID_HOME

чтобы убедиться, что путь указан правильно.

Я пробовал, даже это не сработало, я в точности следил за документацией, но все же, не могли бы вы взглянуть на мою среду с помощью средства просмотра команды? Я даже готов заплатить тебе, это сводит меня с ума, я буквально не знаю, что делать :(

Abdul-Elah JS 14.07.2018 12:09

Не знаю, смогу ли я сделать лучше, чем то, что я объяснил, но вы можете отправить мне электронное письмо по адресу, который вы найдете в моем профиле GitHub.

Florian Thuin 14.07.2018 12:18

ваша учетная запись электронной почты отсутствует в вашем профиле, я думаю, что она конфиденциальна, могу ли я связаться с вами через вашу учетную запись Twitter? @ florian-thuin

Abdul-Elah JS 14.07.2018 12:22

Другие вопросы по теме