Difference between revisions of "User:Saul/nativescript"
From Organic Design wiki
m (→Using tns) |
m (→Using tns) |
||
Line 57: | Line 57: | ||
<source lang="bash"> | <source lang="bash"> | ||
tns create MyApp --template nativescript-vue-template | tns create MyApp --template nativescript-vue-template | ||
+ | cd MyApp | ||
tns run android # run live | tns run android # run live | ||
tns build android | tns build android | ||
</source> | </source> |
Revision as of 03:59, 9 July 2018
Nativescript is a framework for building native ios and android apps.
Nativescript and vue tutorial
Contents
Setup
Firstly ensure that npm is installed.
npm install -g nativescript # Install the nativescript cli
Android
Install
# Install dependencies
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 libstdc++6:i386 # Install dependencies
# OR (If you encounter an error showing "Unable to locate package lib32bz2-1.0")
sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0:i386 libstdc++6:i386
sudo apt-get install g++ # Install the g++ compiler
# Install JDK8/10
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
# OR JDK10 (not currently working)
# sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt install oracle-java8-installer
# OR JDK10 (not currently working)
# sudo apt install oracle-java10-installer
# Set the ENV varible
export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')
Download the android sdk tools from https://developer.android.com/studio/#downloads
Extract it in ~/android/sdk
export ANDROID_HOME=~/android/sdk # Set the ANDROID_HOME ENV varible
# Install dependencies
sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-25" "build-tools;27.0.3" "extras;android;m2repository" "extras;google;m2repository"
Install Emulator
IOS
To build for IOS you will need a machine running MacOS.
Nativescript MacOS install docs
Webpack Template
Using npm
vue init nativescript-vue/vue-cli-template <project-name>
cd <project-name>
npm install
Using tns
I prefer to use tns:
tns create MyApp --template nativescript-vue-template
cd MyApp
tns run android # run live
tns build android