Setup local environment in Ubuntu 18.04

android

#1

Hi,
I am trying to setup local environment in Ubuntu 18.04. getting error in android setup. here screenshot of terminal

and if run $ANDROID_HOME/tools/bin/sdkmanager --list command, get these, i installed all

i am new in nativescript, so please him me to solve this problem

Thanks


#2

there is sdkmanager --list command


#3

what do have in PATH environment variable?


#4

export ANDROID_HOME=$HOME/android/sdk


#5

what does it show when you run “echo $PATH”?


#6

/home/battery/.nvm/versions/node/v8.11.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/battery/.config/composer/vendor/bin


#7

I think you need to add sdk/tools and sdk/platform-tools to the PATH

run this command

export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools


#8

sorry bro, not working, screenshot from .bashrc file


#9

What is the latest output of “tns doctor” and output of “echo $PATH”?


#10

/home/battery/.nvm/versions/node/v8.11.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/battery/.config/composer/vendor/bin:/home/battery/android/sdk/tools:/home/battery/android/sdk/platform-tools

and tns doctor output same, same error, not found sdk


#11

solved the problem, wasn’t problem with PATH, it was android version and build-tools version, i had to install android version 25 and build-tolls 27.0.3
$ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-25" "build-tools;27.0.3" "extras;android;m2repository" "extras;google;m2repository"

btw, thanks, @vamsi


#12

Cool, didn’t realise you had build-tools version 28


#13

The whole process was

# first install 
sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0:i386 libstdc++6:i386

# install java8
sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

# export environment
sudo nano .bashrc

# then paste at last
export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')

# make dir 
mkdir android/sdk

# then download android sdk command line tools only
# extract and copy tools in android/sdk folder

# export environment
sudo nano .bashrc

# then paste at last
export ANDROID_HOME=$HOME/android/sdk

# then file
touch ~/.android/repositories.cfg

# then hit this command and keep typing y and press ENTER
$ANDROID_HOME/tools/bin/sdkmanager --licenses

# then install android sdk
$ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-25" "build-tools;27.0.3" "extras;android;m2repository" "extras;google;m2repository"

# then install emulator
$ANDROID_HOME/tools/bin/sdkmanager "system-images;android-25;google_apis;x86"

# then create emulator
$ANDROID_HOME/tools/bin/avdmanager create avd -n android-25 -k "system-images;android-25;google_apis;x86"

# open emulator
sudo $ANDROID_HOME/tools/emulator @android-25