How to Install android SDK in ubuntu server

做~自己de王妃 提交于 2020-02-24 13:46:11

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/51743028/how-to-install-android-sdk-in-ubuntu-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!