Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Install android SDK in ubuntu server

I have a react native project in ubuntu server, and I want to build an android app for production. to do that I first have to generate Gradle Wrapper files so I run this command in android directory

gradle wrapper --gradle-version <my-gradle-version>

After I run this command I got this error

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

I know how to define SDK location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

But my problem is SDK isn't installed

My question is in react native which sdk I need to build an android app for production and how to install it in ubuntu server

like image 612
Amjed Omar Avatar asked Aug 08 '18 09:08

Amjed Omar


1 Answers

Try This :

download latest android sdk

cd /opt

wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz

tar -xvf android-sdk*-linux.tgz

cd android-sdk-linux/tools

./android update sdk --no-ui --filter platform,platform-tools

set path

echo 'export PATH=$PATH:/opt/android-sdk-linux/platform-tools' >> /etc/profile.d/android.sh

echo 'export ANDROID_TOOLS=/opt/android-sdk-linux' >> /etc/profile.d/android.sh
source /etc/profile.d/android.sh

add i386 support

dpkg --add-architecture i386

apt-get update

apt-get install -y libc6:i386 libstdc++6:i386 zlib1g:i386

install sdks

cd /opt/android-sdk-linux/tools

./android list sdk --all

./android update sdk --no-ui --all
like image 68
Jinesh Chhichhiya Avatar answered Oct 05 '22 20:10

Jinesh Chhichhiya