NativeScript Setup Struggles
So I just spent a solid 5 hours trying to figure out how to solve an issue with NativeScript that could’ve been figured out in about 30 minutes tops.
You ever run into the following error? You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system. Gosh, this problem befuddled me for hours.
And as all developers do, when they face these setup problem, I went straight to stack overflow to have them save the day for me.
Here the best solution I could find on StackOverflow for my problem. In case you dont want to travel to the link, Ill paste down what Aniruddh Joshi posted as an answer.
Alright, so you need to make sure of following:
Make sure you have API 22 installed.
Make sure you you have Android SDK Build Tools 22.x.x installed. (Yes, specifically 22.x.x)
Make sure you have Android support repository installed. (You can find it under Extras section in Android SDK Manager)
Once you have performed steps mentioned above, run
tns doctoragain and you should seeNo issues were detectedmessage.
I made sure that I had Android API 22 installed, several times, over and over. I also triple checked that SDK build tools v22.x.x was installed, in addition to the Android support repo.
Get Shray’s stories in your inbox
Join Medium for free to get updates from this writer.
To no avail, I was still getting the Android SDK 22 not found error. After several other google searches, I decided once and for all, I was done. I came back the next day, and finally (for some weird reason) decided that I would read the NativeScript documentation for help in the installation.
Problem solved. The following command needed to be run in order for my Android SDK 22 to be seen.
export ANDROID_HOME=/usr/local/share/android-sdk
I have no idea what it was set to before, but this command line saved my Friday night, and I was able to finally start running Android with NativeScript.
Additionally, I want to add, run the following commands to make sure you have the latest build tools, and the correctly located java platform.
$ANDROID_HOME/tools/bin/sdkmanager “tools” “platform-tools” “platforms;android-25” “build-tools;25.0.2” “extras;android;m2repository” “extras;google;m2repository”
export JAVA_HOME=$(/usr/libexec/java_home)
This should solve (most) of your problems for the first initial phase of setting and running your NativeScriptCode. My terminal is still telling me there are problems, but its only related to iOS deployment, and I dont care about that, for now, so its A-ok. And wow, it looks like its time to update.
Last note, this seems like a simple problem, though it took me multiple days to solve, but the key point in this I encourage all developers to look at is this: when you have reached a struggle that is keeping you from moving on, at that point, you’ve reached 40% of the way to your solution, continue moving forward, and the solution will find you ;)







