Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 363
Daredevil Avatar asked Oct 13 '18 14:10

Daredevil


4 Answers

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.

like image 197
Dmitry I. Sokolov Avatar answered Oct 21 '22 21:10

Dmitry I. Sokolov


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........

like image 33
SilenceCodder Avatar answered Oct 21 '22 21:10

SilenceCodder


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")
    }
}
like image 38
Vishal Avatar answered Oct 21 '22 23:10

Vishal


downgrade the classpath from

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

to

'com.android.tools.build:gradle:3.3.2'
like image 24
Darpan Rajput Avatar answered Oct 21 '22 22:10

Darpan Rajput