Daredevil
Daredevil

Reputation: 61

Android studio build error with error log of "process unexpectedly exit" in ubuntu

I have installed android studio in ubuntu and whenever i try to create a new project the build is failing with an error saying process unexpectedly exit I am using ubuntu 16.02 LTS version and android studio 3.2.1 version.

This is my build log.

org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:mergeDebugResources 
Caused by: org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.2.1-4818971-linux Daemon #1: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does
Caused by: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.2.1-4818971-linux Daemon #1: Daemon startup failed
Caused by: com.android.builder.internal.aapt.v2.Aapt2InternalException: Failed to start AAPT2 process.
Caused by: java.io.IOException: Process unexpectedly exit.
at com.android.builder.internal.aapt.v2.Aapt2DaemonImpl.startProcess(Aapt2DaemonImpl.kt:110)
... 9 more

I tried to find any help online regarding this but couldn't get any useful ones yet. If this is a normal thing to happen, i am sorry for asking this. I'm a noob to linux as well as to android studio.Thanks in advance for any help.

Upvotes: 5

Views: 37833

Answers (9)

Charlie Villarba
Charlie Villarba

Reputation: 11

What works for me is to downgrade the Gradle Plugin Version to 3.3.2 in the Project Structure. Just go to:

Project Structure > Gradle Plugin Version

Then scroll down to earlier versions. I have tried several versions in my Windows Ultimate OS. I think there is a problem with my current OS.

Upvotes: 1

Mayur Coceptioni
Mayur Coceptioni

Reputation: 443

There are two solutions which i successfully applied. one is you can downgrade the gradle to

classpath 'com.android.tools.build:gradle:3.3.2'

Second one is put this below code in app module gradle

  configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
  config.resolutionStrategy.eachDependency { details ->
    details.useVersion("3.3.2-5309881")
    }
  }

Upvotes: 1

Ali Asheer
Ali Asheer

Reputation: 117

I just updated my gradle build tools to 3.4.2 and it's working fine now. Try this

 classpath 'com.android.tools.build:gradle:3.4.2'

Upvotes: 0

Vishal Dasadiya
Vishal Dasadiya

Reputation: 2585

This issue is because of latest version of AAPT library so please add below code in your Project gradle file under allprojects section.

configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
    config.resolutionStrategy.eachDependency { details ->
        details.useVersion("3.3.2-5309881")
    }
}

Upvotes: 7

Darpan Rajput
Darpan Rajput

Reputation: 169

downgrade the classpath from

'com.android.tools.build:gradle:3.4.1' 

to

'com.android.tools.build:gradle:3.3.2'

Upvotes: 3

rosival santos
rosival santos

Reputation: 11

I had a similar problem in case I did not do anything, and the easiest way to solve this was to update windows to the latest version

Upvotes: 0

varun
varun

Reputation: 2117

April 2019, the problem still exists... the version numbers have just become "higher"...


It first started when Android Studio recommended plugin version gradle:3.4.0 when I hovered the cursor over the project level build.gradle file... Once I do that, it downloaded the latest gradle dependencies and then recommended upgrading the gradle to 5.1.1 to support some new features...

Once that was done, gradle sync failed stating that the Android Studio version should be >= 3.4 to handle the new gradle plugin... (mine was the stable 3.3.2 version)

Android Studio update forced by gradle update

After the patch update of Android Studio, the gradle sync succeeded but any attempt to build the app failed with the cryptic "process unexpectedly exit" message!

So, I just went back to the gradle plugin dependency gradle:3.3.2 as a workaround... Everything worked fine!

Oh yeah, don't accept the update when you see this dialog (for now)! :P

Gradle update dialog

Upvotes: 1

SilenceCodder
SilenceCodder

Reputation: 3174

It took alot of hours for me to found the solution. Just goto your build.gradle file change

   classpath 'com.android.tools.build:gradle:3.2.1' to
    classpath 'com.android.tools.build:gradle:3.1.4' 

after that install the SDK tools(if it's ask to install) After that Run your Project.. Happy coding........

Upvotes: 7

David I. Lipkind
David I. Lipkind

Reputation: 187

Same for me. I also have ho solution but workaround. In project-level build.gradle downgrade gradle version from

classpath 'com.android.tools.build:gradle:3.2.x'

to

classpath 'com.android.tools.build:gradle:3.1.4'

In my case it makes project build. Wish someone tells a right solution.

Upvotes: 7

Related Questions