# Is it possible to use NativeScript?

**URL:** <https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436>\
**Category:** General\
**Created:** [June 2, 2024, 9:19pm UTC](https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436 "2024-06-02T21:19:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zonetecde](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/zonetecde/32/382_2.png) [@zonetecde](https://community.firebasestudio.dev/u/zonetecde)\
**Post date:** [June 2, 2024, 9:19pm UTC](https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436/1 "2024-06-02T21:19:07Z")

</div>

Hello there!

I’d like to develop a mobile app using **NativeScript**. I installed the CLI through an `npm` command, set up a new project, but when I try to launch it in Android using `ns run android`, it fails because it needs an Android emulator.

Is it possible to make it work with IDX?

Thank you c:

The output :

```auto
blank-test-7031061:~/blank-test/example-app{master}$ ns run android
✔ 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.
✖ 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 with your current android runtime, install one of the following supported Android SDK targets:
  android-17
  android-18
  android-19
  android-20
  android-21
  android-22
  android-23
  android-24
  android-25
  android-26
  android-27
  android-28
  android-29
  android-30
  android-31
  android-32
  android-33
  android-34
Supported targets vary based on what android runtime you have installed. Currently your app uses @nativescript/android null 
 Run `$ sdkmanager` to manage your Android SDK versions. 

✖ No compatible version of the Android SDK Build-tools are installed on your system. You can install any version in the following range: '>=23 <=34'. 
 Install the required build-tools through Android Studio. In case you already have them installed, make sure the `ANDROID_HOME` environment variable is set correctly. 

✖ Error executing command 'javac'. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable. 
 You will not be able to build your projects for Android.
To be able to build for Android, verify that you have installed The Java Development Kit (JDK) and configured it according to system requirements as
 described in https://docs.nativescript.org/setup 

✖ WARNING: The Java Development Kit (JDK) is not installed or is not configured properly. 
 You will not be able to work with the Android SDK and you might not be able
to perform some Android-related operations. To ensure that you can develop and
test your apps for Android, verify that you have installed the JDK as
described in http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html (for JDK 8). 

Your environment is not configured properly and you will not be able to execute local builds.
Verify that your environment is configured according to the system requirements described at
https://docs.nativescript.org/setup/linux#setting-up-linux-for-android.v

```

---

<div class="post-metadata">

**Author:** ![kirupa](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/kirupa/32/4_2.png) [@kirupa](https://community.firebasestudio.dev/u/kirupa)\
**Post date:** [June 3, 2024, 6:12pm UTC](https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436/2 "2024-06-03T18:12:48Z")

</div>

Hi @zonetecde - that is interesting! With our Flutter project template, the workspace has all of the dependencies configured for building and previewing apps using the Android emulator.

I am thinking out loud here, but have you tried running this command inside a Flutter workspace? The Android emulator would be present there, so this error may not appear there.

Thanks,  
Kirupa

---

<div class="post-metadata">

**Author:** ![zonetecde](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/zonetecde/32/382_2.png) [@zonetecde](https://community.firebasestudio.dev/u/zonetecde)\
**Post date:** [June 3, 2024, 6:32pm UTC](https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436/3 "2024-06-03T18:32:30Z")

</div>

Just tried it, but sadly, it does not work, and I got the exact same output. Good idea though 🙂 !

---

<div class="post-metadata">

**Author:** ![Sunny](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/sunny/32/85_2.png) [@Sunny](https://community.firebasestudio.dev/u/Sunny)\
**Post date:** [June 3, 2024, 10:18pm UTC](https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436/4 "2024-06-03T22:18:51Z")

</div>

_ **Flutter workspace required** _

You have to set `ANDROID_HOME` as stated in the documents  
([Setting up Linux for NativeScript | NativeScript](https://docs.nativescript.org/setup/linux#:~:text=export%20ANDROID_HOME%3D%24HOME/Android/Sdk))

```auto
export ANDROID_HOME=/opt/android 

```

To make this permanent add the follow snippet to `dev.nix`

```auto
  env = {
    ANDROID_HOME=/opt/android;
  };

```

After rebuilding the environment, you can ensure that it works by running this command:

```auto
ns doctor android

```

[WARNING: DO NOT SET `PATH` IN nix.dev, DUE TO A BUG, IT MAY LEAD YOUR WORKSPACE TO BE PERMENTANLY BROKEN](https://issuetracker.google.com/issues/341319148)

---

<div class="post-metadata">

**Author:** ![zonetecde](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/zonetecde/32/382_2.png) [@zonetecde](https://community.firebasestudio.dev/u/zonetecde)\
**Post date:** [June 4, 2024, 6:33am UTC](https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436/5 "2024-06-04T06:33:53Z")

</div>

It worked, thank you !!!

 ![image](https://us1.discourse-cdn.com/flex002/uploads/idxcommunity/original/1X/b25123858cb0167df71b627724095f8cf27f13e5.png)

---

<div class="post-metadata">

**Author:** ![AterKenshi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/aterkenshi/32/1471_2.png) [@AterKenshi](https://community.firebasestudio.dev/u/AterKenshi)\
**Post date:** [August 26, 2024, 10:25pm UTC](https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436/6 "2024-08-26T22:25:40Z")

</div>

Sorry for reopening this thread. I tried this too and it worked up to some point. I tried changing the command in .nix file to use ns run android, when having the environment and keeping the manager as flutter, but I’m getting an error saying “ns ENOENT”.

I can remove that and run the command manually while having manager=“flutter” and it shows a green loader at top.

In Both cases I can work with the emulator, but it kinda annoys me and I would like the project to run ns run android so I can keep coding right away without having to run the command manually.

---

<div class="post-metadata">

**Author:** ![Prakhar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/prakhar/32/44_2.png) [@Prakhar](https://community.firebasestudio.dev/u/Prakhar)\
**Post date:** [August 27, 2024, 5:15pm UTC](https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436/7 "2024-08-27T17:15:21Z")

</div>

Awesome! Can you submit this template on [GitHub - project-idx/community-templates: A library of templates to get you started faster and explore tools, frameworks, and runtimes.](https://github.com/project-idx/community-templates)?

---

<div class="post-metadata">

**Author:** ![AterKenshi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/aterkenshi/32/1471_2.png) [@AterKenshi](https://community.firebasestudio.dev/u/AterKenshi)\
**Post date:** [August 27, 2024, 6:22pm UTC](https://community.firebasestudio.dev/t/is-it-possible-to-use-nativescript/436/8 "2024-08-27T18:22:59Z")

</div>

Can I somehow get the required files from the flutter project I tweaked? I think that might make it easier to get a template.
