如何在Ubuntu Server中安装Android SDK [英] How to Install android SDK in ubuntu server

查看:447
本文介绍了如何在Ubuntu Server中安装Android SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ubuntu服务器中有一个react native项目,我想构建一个Android应用进行生产.为此,我首先必须生成Gradle Wrapper文件,因此我在android目录

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

我知道如何在local.properties文件中使用sdk.dir或使用ANDROID_HOME环境变量来定义SDK位置.

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

但是我的问题是未安装SDK

But my problem is SDK isn't installed

我的问题是在React native中,我需要为生产构建一个android应用程序以及如何在ubuntu服务器中安装sdk

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

推荐答案

尝试一下:

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

设置路径

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

添加i386支持

dpkg --add-architecture i386

apt-get update

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

安装SDK

cd /opt/android-sdk-linux/tools

./android list sdk --all

./android update sdk --no-ui --all

这篇关于如何在Ubuntu Server中安装Android SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆