1

Hello I have installed in my Ubuntu Android Studio with the intention of using them SDK with React Native, Cordova, Phonegap, etc.

I have searched other questions on this site and tried the solutions they offered, but the result so far is that what I show next, after 10 days installing and testing I have decided to ask my question.

I made the installation according to the official page of Android Studio and in several ways, but I can not get it to work.

Now I have the installation of the following way, to avoid problems of permissions:

  • Copy the downloaded folder from Android Studio to /usr/local/

  • For the SDK I chose a folder in my personal folder /home/charly/Android/sdk/

    • Install the necessary libraries for 32-bit sudo apt-get install libc6: i386 libncurses5: i386 libstdc ++ 6: i386 lib32z1 lib32bz2-1.0
  • To run the Android Studio installer, I placed it in the Android Studio location in the bin folder using the terminal: cd/usr/local/android-studio/bin

    • Execute: ./studio.sh
  • I edit the .bashrc file: sudo vim ~/.bashrc and add the following to the end of the file:

    export PATH=${PATH}:/home/charly/Android/sdk/tools export PATH=${PATH}:/home/charly/Android/sdk/platform-tools

    • Install:

    sudo apt-get install lib32stdc ++ 6 sudo apt-get install lib32z1

    • When I run android sdk and android avd the answer is: Order «android» not found. When should I take the SDK Manager and AVD Manager, respectively.

Also, there is another problem and when executing printenv ANDROID_HOME the result of the console is: /opt/android-sdk/ And in this folder is not Android Studio.

When I try to run an Android application from React Native: react-native run-android I get an error:

S server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug) ...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ': app'.
> The SDK directory '/ opt / android-sdk' does not exist.

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

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

Command failed: ./gradlew installDebug

Error: Command failed: ./gradlew installDebug
    at checkExecSyncError (child_process.js: 611: 11)
    at Object.execFileSync (child_process.js: 629: 13)
    at runOnAllDevices (/home/charly/proyec/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
    at buildAndRun (/home/charly/proyect/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
    at isPackagerRunning.then.result (/home/charly/proyect/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
    at process._tickCallback (internal / process / next_tick.js: 68: 7)

How can I solve these problems? Why does it tell me that SDKs do not exist in '/opt/android-sdk' if I set up .bashrc to say they are in home/charly/Android/sdk?

Maybe the question is extensive, but I want to explain the whole installation and they can see the mistakes I've made in this one. Thank you

1 Answers1

0

You need to set the ANDROID_HOME environment variable in one of your bash startup scripts. This is explained in detail elsewhere on Stackoverflow.

Alternatively, you could add a local.properties file to configure the SDK location.

Kai
  • 2,529
  • 1
  • 15
  • 24