Hot questions for Using Ubuntu in android studio

Top Java Programmings / Ubuntu / android studio


I installed the java jdk1.8.0_111 and installed android studio in ubuntu 16.04 (32 bits), but when I run android studio I get the message:

Error:Process 'command '/usr/local/android-studio/jre/bin/java'' finished with non-zero exit value 2

What should I do?


I found the solution. I think Android Studio was using 2 java compilers, one built-in from android studio, and the other the one that I had installed in order to install Android Studio.

In Android Studio, On the menu File -> Project Structure : change the default JDK location directory to your own, in my case it was:


and I changed to

/usr/local/java/jdk1.8.0_111 #path_to_your_jdk

which is the version that I installed.


I am trying to get Android Studio running. I have installed jdk and jre

sudo apt-get install default-jre
sudo apt-get install default-jdk

I have set up my .bashrc and /etc/environment file to

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH

but still nothing.

$JAVA_HOME returns correct value and so do java -version and whereis javac

What am I missing?


Following step worked for me

  2. then type command sh or ./


I am using Android Studio on Ubuntu. I started Android Studio, created a "New Project" and started it with Shift+F10. It threw the following error:

Error:Error: org.gradle.process.internal.ExecException: Process 'command '/home/laptop/Android/Sdk/build-tools/21.1.2/aapt'' finished with non-zero exit value 127
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Information:BUILD FAILED

Also it showed me a PNG file with a circle an a transparent background with file name: abc_btn_radio_to_on_mtrl_000.png

After I just tried running the app again I now have 2 errors instead of one:

/home/laptop/AndroidStudioProjects/TestIt420/app/build/intermediates/explo     ded-aar/     v4/abc_ic_ab_back_mtrl_am_alpha.png
 Error:Error:      org.gradle.process.internal.ExecException: Process 'command      '/home/laptop/Android/Sdk/build-tools/21.1.2/aapt'' finished with non-zero      exit value 127
Error:Execution failed for task ':app:mergeDebugResources'.
>     /home/laptop/AndroidStudioProjects/TestIt420/app/build/intermediates/explo    ded-aar/    v4/abc_ic_ab_back_mtrl_am_alpha.png: Error:     org.gradle.process.internal.ExecException: Process 'command     '/home/laptop/Android/Sdk/build-tools/21.1.2/aapt'' finished with non-zero     exit value 127
Information:BUILD FAILED

Can you maybe help me in resolving the issue?


You have to install These Packages to Solve this Error Because Android SDK Still not working on UBUNTU 64 Bit.

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


I have an issue with Android Studio on Ubuntu. Until now, I used to run Android Studio in console mode by going to the android-studio/bin folder and running It works well, but it's boring for me type the commands each time I want to run it, I'd prefer to open it simply clicking on a shortcut. So, I tried to create a shortcut in my task bar.

In /usr/share/applications, I created a file named "android-studio.desktop". Here is the content of the file :

[Desktop Entry]
Name=Android Studio

Then I dragged the desktop file onto the task bar. When I try to open Android Studio using my new shortcut, I get :

No JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.

However, when I run the command echo $JAVA_HOME, I get the following path :


And in my PATH variable (just copying the end of the PATH content) :


Because Android Studio works when I run it using command lines & because JAVA_HOME is correctly set, I don't understand why my shortcut does not work...

I searched on the internet and didn't find anybody in the same situation. It's not a big problem because I can still run AS, but I'd really like to understand why the shortcut does not work.

Thank you for your help !


Probably your JAVA_HOME is not found here.

You can define it as a system-wide environment variable in /etc/environment eg. like this:

sudo nano /etc/environment

and add the following line to the end:


Save and reboot your box.

Note: you can let Android Studio create the desktop entry on the Dash for you, eg. from the welcome window (Configure / Create Desktop Entry) or Tools / Create Desktop Entry... It will create the file jetbrains-android-studio.desktop in ~/.local/share/applications.


I use Android Studio 3.1.4 on Ubuntu 18.04.1. I wanted to quickly create the UI of the main (default) activity so I opened the Layout Editor. Some errors have occurred. Then I tried to add a button: it doesn't seem to be displayed in the Blueprint (and the ConstraintLayout is weirdly displayed too).

Similar StackOverflow questions - Android support library

Similar questions have been asked in StackOverflow. The answers were to use a different version of the Android support library. Currently, I'm using this version:

implementation '' (file: build.gradle(Module: app)).

Indeed, even if Android Studio recommended me to use 28.0.0-rc02, I don't see it in this list: .

By the way, I encountered all of the mentionned bugs with 28.0.0-rc02 too. In résumé, I encounter all of these bugs with 28.0.0-rc01 (currently used) and 28.0.0-rc02. I didn't try other versions for the moment.

Using implementation '

With implementation '', all the problems are solved. However:

  1. It's not the last version ( indicates the last version is: 28.0.0-rc01, Android Studio indicates it's 28.0.0-rc02 - both bug)

  2. Android studio underlines in red my implementation instruction as follows:

Errors opening the Layout Editor
  1. Render problem

Failed to load AppCompat ActionBar with unknown error.

  1. The following classes could not be instantiated

- (Open Class, Show Exception, Clear Cache) - (Open Class, Show Exception, Clear Cache) - (Open Class, Show Exception, Clear Cache)

Exception Details:

java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener at at at at java.lang.ClassLoader.loadClass( at java.lang.ClassLoader.loadClass( at at at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newInstance( at at at at at android.view.BridgeInflater.loadCustomView( at android.view.BridgeInflater.loadCustomView( at android.view.BridgeInflater.createViewFromTag( at android.view.LayoutInflater.createViewFromTag( at android.view.LayoutInflater.rInflate_Original( at android.view.LayoutInflater_Delegate.rInflate( at android.view.LayoutInflater.rInflate( at android.view.LayoutInflater.rInflateChildren( at android.view.LayoutInflater.inflate( at android.view.LayoutInflater.inflate( at at at at at at at at at$inflate$3( at at java.util.concurrent.ThreadPoolExecutor.runWorker( at java.util.concurrent.ThreadPoolExecutor$ at

Blueprint problems - What is in my UI?

For the moment, nothing apart the root component (a ConstraintLayout instance), as you can see (note that the ConstraintLayout seems to be represented as a very little square in the Blueprint - that's a Blueprint problem, no?):

If I drag'n drop a button with the text "TEST TEST TEST" in the Blueprint, I get this (note that the button... doesn't really appear, only a weird thing is displayed inside the square):

I clicked several time on this square with a weird thing inside. I got this new exception:

Missing Constraints in ConstraintLayout

This view is not constrained vertically: at runtime it will jump to the top unless you add a vertical constraint The layout editor allows you to place widgets anywhere on the canvas, and it records the current position with designtime attributes (such as layout_editor_absoluteX). These attributes are not applied at runtime, so if you push your layout on a device, the widgets may appear in a different location than shown in the editor. To fix this, make sure a widget has both horizontal and vertical constraints by dragging from the edge connections.

My question

I'm a little lost in the middle of all these mistakes and exceptions. What am I supposed to do? I'm reading again the documentation ( but they don't seem to have this weird behavior (I'm talking about problems displaying my button in the Blueprint and the exceptions I copied/pasted in this question).

Important edit

Which version of Android Support Library should I use? In particular: what should I do to use the latest version? (either rc-1, or rc-2 - Android Studio recommends the rc-2 but this one doesn't appear in )


Latest Versions of Support libraries is still under development and may contain bugs

Until it ends you can downgrade version to 28.0.0-alpha1

implementation ''


I have followed the instructions on the official site.

But I am unable to install Android Studio. I'm getting error message "An error occurred while trying to compute required packages" as shown in the attached image.

Few months back when I tried to install Android Studio there are instruction in Android Studio official webpage to install Java JDK. Today I don't find any traces about it. Do I need to install any Java related file to fix the error?


Of course you need to install the Java Development Kit.

sudo apt-get install openjdk-8-jdk

... e.g. in the terminal should do the trick.


There's a manual workaround!

As per post :

  1. Download the command line tools, place them in the SDK folder (e.g., on mac: /Users/user/Library/Android/sdk), and then add the bin folder to the PATH.
  2. Install the latest platform: in a terminal, execute sdkmanager "platforms;android-25"
  3. Open Android Studio, and go to the SDK Manager (Appearance and Behavior > System Settings > Android SDK)
  4. Click on "Edit", and then select the sdk folder. Then "Next" > "Next" > "Finish".

Still, it doesn't resolve the missing emulator package therefore the Android SDK tools can't be updated since it's a dependency. But Android studio works and you can download other packages.

Looking forward to a better solution.

Update 2:

Solution to emulator package issue!

After digging in the repo's XML for a while I've spotted the issue.

It turns out that the "emulator" package is only in channel 3 (canary) while the "tools" package is in channel 0 (stable) but depends on "emulator". The solution is to force the manager to download the "emulator" package from channel 3:

./sdkmanager --channel=3 emulator

Problem solved!


I have installed android studio in Ubuntu 16.04. If I start a project then run button is automatically disabled.I have installed all the packages in SDK. The error shows as below.

And the log message shows as below.

    WARN - nal.AbstractExternalSystemTask - Cause: error=13, Permission denied 
com.intellij.openapi.externalSystem.model.ExternalSystemException: Cause: error=13, Permission denied


    at org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension.getUserFriendlyError(
    at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$
    at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(
    at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(
    at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(
    at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(
    at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(
    at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(
    at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(
    at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(
    at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$
    at com.intellij.openapi.progress.impl.CoreProgressManager$
    at com.intellij.openapi.progress.impl.CoreProgressManager$
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$
    at com.intellij.openapi.application.impl.ApplicationImpl$
    at java.util.concurrent.Executors$
    at java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.util.concurrent.ThreadPoolExecutor$

[ 196770]   WARN - radle.project.ProjectSetUpTask -  
[ 197344]   WARN - - NDK support for project 'ActionBarCompat-ShareActionProvider' is disabled because the project doesn't contain any valid native configurations.

Please help me to resolve this error.


I reinstalled android studio by standard installation. Installed all the SDK components at the time of installation. Now the issue was solved.


i just installed Xubuntu x32 bit. Then i installed android studio and java sdk. But when i open android studio project it shows me:

"Error:Process 'command '/usr/local/android-studio/jre/bin/java'' finished with non-zero exit value 2"

This is the terminal output:

nal.AbstractExternalSystemTask - Process 'command '/usr/local/android-studio/jre/bin/java'' finished with non-zero exit value 2 
com.intellij.openapi.externalSystem.model.ExternalSystemException: Process 'command '/usr/local/android-studio/jre/bin/java'' finished with non-zero exit value 2

This is JAVA_HOME path:

export JAVA_HOME="/usr/lib/jvm/jdk1.8.0_101" 
export PATH="$PATH:$JAVA_HOME/bin"


Choose File->Project Structure Write your /usr/lib/jvm/jdk1.8.0_101 to "JDK location". It`s help to me with the same problem. But you must have write permissions to /usr/local/android-studio.

I have installed studio in my home folder.