Search code examples
ubuntuandroid-studioandroid-emulatorandroid-sdk-tools

Where is the official Android emulator located in Ubuntu? (To execute it independently from Android Studio)


Please, correct me if I'm wrong.

Before Android Studio, most people used the Android SDK. After installing it and adding it to the PATH android_folder/sdk and android_folder/platform-tools, we could execute from terminal:

android avd

As the default platform now is Android Studio. I have tried the following:

  • Find a file named avd within the Android Studio folder. I have not find it.

  • Download the SDK Tools Only, but it seems it does not include any file named avd either.

I'm using OpenJDK. I'm on Ubuntu 14.04LTS. I have added Android Studio to the path: export PATH=$PATH:~/location_of_android-studio/bin. I have added OpenJDK to the path too: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 and export PATH=$PATH:$JAVA_HOME/bin.

If I type: android avd, it returns: android: command not found


Solution

  • you have the official emulator by downloading the android-sdk (with or without the studio), if your using cordova to create your app you can run

    cordova emulate android
    

    or

    ionic run -l
    

    the -l automatically refreshes the emulation when you change the code

    or

    ripple emulate -p 1234
    

    all of these options require npm to be installed.

    once you have npm installed, to install cordova run 'sudo npm install -g cordova ionic ripple'

    sudo add-apt-repository ppa:chris-lea/node.js
    
    sudo apt-get update
    
    sudo apt-get install nodejs
    
    sudo npm install npm -g
    

    It is recommended to put the sdk in /usr/local so all users can access it, I did not install the studio IDE and putting it in that location caused ownership permisssions problems and the AVD's default to the root/.android/avd folde

    my install location for the sdk is usr/local/android-sdk-linux which is under the root profile so I just allowed anyone to run/write to this directory chmod -R 777 usr/local/android-sdk-linux

    this may not be the recommended option and I now have the problem that the device definitions (ini) are not being created in my local .android/avd folder because it has to be run with sudo permissions to update but it then is looking locally for the device definitions when you use cordova/ionic to start the emulation because these are being run under the local user not the sudo user (sudo /user/local/android-sdk-linux/tools/android avd)

    The other option is to install it in my own home/conor directory and then set the ANDRIOD_HOME path variable like below in .profile

    export ANDROID_HOME=/home/conor/android-sdk-linux/
    export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
    

    The created AVD's by android avd command are now created in /home/conor/.android/avd folder.