
Я здесь новичок и решил перейти на Ubuntu на постоянной основе, чтобы заняться разработкой приложений в качестве хобби.
Так как у меня процессор AMD "RYZEN", эмуляция либо работала, либо нет, я обнаружил, что в Ubuntu все работает отлично, поскольку там есть эмуляция оборудования, затем установил Android Studio и т. п., Java и настроил переменные среды.
затем установил NativeScript и запустил тест среды tns doctor
, и результат получился таким:
✔ Getting environment information
No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.0.3 version and is up to date.
Затем я установил VSCODE, затем создал тестовый проект Nativescript и он был создан правильно, открыл его в VSCODE и создал конфигурацию отладки.
затем запустите эмулятор Android и попробуйте запустить id сделал Launch на Android и получил
WARNING: 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: 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: 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
WARNING: Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later.
Run `$ sdkmanager` to manage your Android SDK versions.
WARNING: You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=28'.
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.
Javac is installed and is configured properly.
The Java Development Kit (JDK) is installed and is configured properly.
Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
Если я запущу терминал как обычный пользователь, tns run
приложение будет создано и подключено к эмулятору Android.
Те же проблемы, что и в Cordova, выдает похожую ошибку $ANDROID_HOME is not set correct, хотя я все еще могу запустить вызов «cordova emulate android».
Я подозреваю, что VSCODE не может правильно видеть среду или у расширений возникли проблемы или ошибка?
Будем признательны за любую помощь.
решение1
Хорошо, я нашел кое-что интересное во время поиска,«установить переменную окружения для всех пользователей в Ubuntu»и получилэтот сайт
Затем я последовал его инструкциям, установил его ANDROID_HOME
и перезагрузил систему.. и теперь NativeScript нашел среду и запустил проект в работающем эмуляторе..
Кроме того, Кордова тоже смогла найти окружающую среду, но у меня возникла другая проблема.
Если найду ответ на вопрос о Кордове, задам еще один вопрос.
Три дня я ломал голову... как это правильно настроить.