How to Install android SDK in ubuntu server
Asked Answered
D

1

8

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

Doorframe answered 8/8, 2018 at 9:22 Comment(3)
Is android studio installed in your PC?Gillen
No, I have ubuntu serverDoorframe
Please follow the instruction for building react native project in Linux : facebook.github.io/react-native/docs/getting-startedGillen
D
22

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
Dim answered 8/8, 2018 at 11:27 Comment(3)
How can I check the latest version of the android sdk? I think the "android-sdk_r24.4.1-linux.tgz" might be outdated by nowPresidio
@lcsvcn this might be helpful developer.android.com/studio/command-line/sdkmanagerLakin
I've installed SDK correctly, but when I run flutter doctor --android-licenses I get Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this. flutter doctor -v says Android SDK at /opt/android-sdk-linux how can I fix this?Embodiment

© 2022 - 2024 — McMap. All rights reserved.